guietta - a tool for making simple Python GUIs

Overview

guietta

A tool for making simple Python GUIs

Guietta is a tool that makes simple GUIs simple:

", "result", _, _, _ ], [ _, _, _, _, Quit ] ) with gui.Calculate: gui.result = float(gui.a) + float(gui.b) gui.run() ">
from guietta import _, Gui, Quit
gui = Gui(
	[ "Enter numbers:",  "__a__", "+", "__b__", ["Calculate"] ],
	[    "Result: -->", "result",   _,       _,             _ ],
	[                _,        _,   _,       _,          Quit ]
)

with gui.Calculate:
	gui.result = float(gui.a) + float(gui.b)

gui.run()

And here it is:

Example GUI

Also featuring:

  • matplotlib and pyqtgraph integration, for easy event-driven plots
  • easily display columns of data in labels using lists and dicts
  • multiple windows
  • customizable behaviour in case of exceptions
  • queue-like mode (a la PySimpleGUI)
  • integrate any QT widget seamlessly, even your custom ones (as long as it derives from QWidget, it is OK)
  • easy background processing for long-running operations
  • ordinary QT signals/slots, accepting any Python callable, if you really want to use them

Installation

pip install guietta

If you use conda, please read our page on QT incompatibilities with conda.

Install on older platforms

Guietta uses the PySide2 QT binding by default, and some systems (older Macs, Raspberry PI) do not have it available. Guietta can fallback to the PyQt5 binding if available, but does not specify it as an automatic dependency. If you get an installation error about PySide2, try to use PyQt5 instead using the following:

    pip install guietta --no-deps
    pip install pyqt5

Documentation

Stable version: https://guietta.readthedocs.io/en/stable/

Latest update from github: https://guietta.readthedocs.io/en/latest/

Tests

Documentation Status

Comments
  • Considering releasing/accepting PR for dedicated builds for Conda?

    Considering releasing/accepting PR for dedicated builds for Conda?

    Given the incompatibility of pip's QT implementation with conda as mentioned by documentation, will a dedicated build for conda make more sense for other packages to properly depend on guietta?

    Some reasons why this approach may make sense:

    • https://github.com/ContinuumIO/anaconda-issues/issues/1554 suggests building specifically for conda and using conda dependencies to address the incompatibility since they will not rename pyqt.
    • Other packages do not have to include the incompatibility notice or risk unaware users breaking their conda environments.
    opened by kevin931 6
  • Guietta :ValueError: Could not determine the Gui instance identifier

    Guietta :ValueError: Could not determine the Gui instance identifier

    Python version used : 3.7

    kindly help to resolve this issue. script : from guietta import _, Gui, Quit

    gui = Gui(

    [ 'Enter numbers:', 'a' , '+' , 'b', ['Calculate'] ], [ 'Result: -->' , 'result' , _ , _ , _ ], [ _ , _ , _ , _ , Quit ] )

    with gui.Calculate: gui.result = gui.a + gui.b

    gui.run()

    Error:

    C:\Users\labuser\Downloads\temp>python cguietta.py Traceback (most recent call last): File "cguietta.py", line 11, in gui.result = gui.a + gui.b File "C:\Users\labuser\AppData\Local\Programs\Python\Python37\lib\site-packages\guietta\guietta.py", line 159, in exit raise ValueError('Could not determine the Gui instance identifier') ValueError: Could not determine the Gui instance identifier

    C:\Users\labuser\Downloads\temp>

    opened by mahanthkj 5
  • AttributeError: __enter__

    AttributeError: __enter__

    I just installed Guietta because i got a new pc, and i tried the example but this exception kept appearing

    >>> from guietta import _, Gui, Quit
    >>> gui = Gui(
    ... [ "Enter numbers:",  "__a__", "+", "__b__", ["Calculate"] ],
    ... [    "Result: -->", "result",   _,       _,             _ ],
    ... [                _,        _,   _,       _,          Quit ]
    ... )
    >>>
    >>> with gui.Calculate:
    ...     gui.result = float(gui.a) + float(gui.b)
    ...
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: __enter__
    >>> gui.run()
    

    Guietta version is (0.2.3)

    opened by ghost 4
  • Regression: PySide objects considered a `_ContextInt`.

    Regression: PySide objects considered a `_ContextInt`.

    Worked in 0.3.3, broken in 0.3.4.

    MWE:

    from guietta import Gui
    from PySide2.QtWidgets import QProgressBar
    
    gui = [(QProgressBar(), "progress")]
    
    gui.progress.SetFormat("%p% of files")
    gui.progress.setValue(0.4)
    

    Tracebacks:

    Traceback (most recent call last):
      File "gui.py", line 65, in <module>
        MyApp("My Fancy App").run()
      File "gui.py", line 30, in __init__
        self.set_progress(0, 0)
      File "gui.py", line 38, in set_progress
        self.progress.setFormat(f"{i} / {n} (%p%)")
    AttributeError: '_ContextInt' object has no attribute 'setFormat'
    
    Traceback (most recent call last):
      File "gui.py", line 65, in <module>
        MyApp("My Fancy App").run()
      File "gui.py", line 30, in __init__
        self.set_progress(0, 0)
      File "gui.py", line 39, in set_progress
        self.progress.setValue(100 * i / n if n != 0 else 0)
    AttributeError: '_ContextInt' object has no attribute 'setValue'
    
    opened by masasin 4
  • qt.qpa.plugin: Could not load the Qt platform plugin

    qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.

    input: from guietta import _, Gui, Quit

    output:

    qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: direct2d, minimal, offscreen, windows.```
    opened by Ajinkz 4
  • "title" not implemented in pip-available egg

    First, I have to say that I love guietta. It indeed makes simple GUIs simple. Yay! I know past jobs that I would have done with it, had it existed earlier. Some of my future jobs will use it I guess!

    Documentation says

    On https://guietta.readthedocs.io/en/latest/index.html#installation says:

    pip install guietta
    

    and on https://guietta.readthedocs.io/en/latest/reference.html#guietta.Gui

    class guietta.Gui(*lists, images_dir='.', create_properties=True, exceptions=<Exceptions.POPUP: 3>, persistence=1, title='')

    Notice that all pages there mention "guietta 0.3.4 documentation".

    Steps to reproduce (here we go!)

    Install guietta

    Following https://guietta.readthedocs.io/en/latest/index.html#installation :

    pip install guietta
    
    Collecting guietta
      Using cached guietta-0.3.4-py2.py3-none-any.whl (37 kB)
    Requirement already satisfied: PySide2 in _someplace_ (from guietta) (5.15.0)
    Requirement already satisfied: shiboken2==5.15.0 in _someplace_ (from PySide2->guietta) (5.15.0)
    Installing collected packages: guietta
    Successfully installed guietta-0.3.4
    

    Have some code

    Create this file test.py:

    from guietta import Gui
    
    gui = Gui(
        [ 'test' ]
    )
    
    gui2 = Gui(
        [ 'test' ],
        title="foo"
    )
    

    Run it, fail

    python test.py 
    
    Traceback (most recent call last):
      File "test.py", line 7, in <module>
        gui2 = Gui(
    TypeError: __init__() got an unexpected keyword argument 'title'
    (python) 
    

    Workaround

    git clone https://github.com/alfiopuglisi/guietta
    cd guietta
    pip install -e $PWD
    
    Obtaining file:///_someplace_
    Requirement already satisfied: PySide2 in _someplace_ (from guietta==0.3.4) (5.15.0)
    Requirement already satisfied: shiboken2==5.15.0 in _someplace_ (from PySide2->guietta==0.3.4) (5.15.0)
    Installing collected packages: guietta
      Attempting uninstall: guietta
        Found existing installation: guietta 0.3.4
        Uninstalling guietta-0.3.4:
          Successfully uninstalled guietta-0.3.4
      Running setup.py develop for guietta
    Successfully installed guietta
    

    Then back to previous directory:

    python test.py
    

    No error!

    Summary

    • The version 0.3.4 available via pip install does not implement title. Fine.
    • The version 0.3.4 tagged in git also does not implement title. Fine.

    There are two problems.

    • Problem 1: the version of guietta available via the method stated in documentation ( pip install guietta) does not match the documentation content.
    • Problem 2: online documentation https://guietta.readthedocs.io/en/latest/reference.html#guietta.Gui claims it documents 0.3.4 but it's false, as it documents title which is not in 0.3.4 and was added two commits later.

    Why is this important?

    I can't publish code that relies on title feature and pip install guietta, it will break for users.

    Suggestion

    Three steps:

    1. Make a consistent process by which tagging a version and pushing to readthedocs is the same process (one can't be done separated from the other). I would write a local makefile but perhaps a github automation of some sort is a possible alternative.
    2. Tag current master as 0.3.5, updating the docs at the same time.
    3. Users are happy with guietta! Well, at least this issue is closed!

    Thanks!

    opened by fidergo-stephane-gourichon 3
  • projections in matplotlib widget?

    projections in matplotlib widget?

    Hi

    Is there a way to create a plot with a projection in guietta, e.g. for a polar or 3d plot?

    I believe the corresponding projection keyword has to be supplied to matplotlib's add_subplot, which is currently not implemented in guietta. Maybe one can add the projection keyword to the MatplotlibWidget? It would be quite a simple change to enhance the plot types available. And because the keyword is optional, it would be backward compatible.

    Cheers!

    opened by bigbenhur 2
  • A few questions

    A few questions

    Hello there, first of all, you did an amazing job with this tool, its really easy to use. Here are my questions;

    1. How can i change the background to a color or image?
    2. Can i change the program title somewhere else in the program, or do i have to redraw the screen?
    3. Is it possible to open new forms in the main form?

    Thanks for reading, and once again good job.

    opened by ghost 2
  • How does one hide entered characters

    How does one hide entered characters

    Using guietta, a simple password application would look like

    from guietta import _, Gui, Quit
    gui = Gui(
    
      [  'Enter Username:', '__username__'  , _ , _,  ['Login'] ],
      [  'Enter Password:'  , '__password__' ,  _  ,    _   ,       _ ],
      [  "Access Level: " ,    "Access_Level"     ,  _  ,    _   ,      Quit      ]
    )
    with gui.Login:
        if gui.username == "Username" and gui.password == "Password":
            gui.Access_Level = "Admin"
        else:
            gui.Access_Level = "Incorrect Login Entered"
    gui.run()
    

    The only problem is that the password is obvious to everyone. Is there any way to hide it?

    opened by MySixSenses 2
  • HOW TO customize the gui window title?

    HOW TO customize the gui window title?

    Hi!

    Operating System: Windows 8.1 Python version: Python 3.7.4 guietta Port and Version: guietta 0.3.8 Code or partial code causing the problem:

    1. How do I customize the window's title? Is there a way to do it without installing PyQt?
    2. How do I make row spacing smaller so as not to occupy twice the window space needed?

    Thank you.

    opened by virbcal 2
  • Stopping continuous background executions

    Stopping continuous background executions

    I'm trying to write a gui with a function similar to the one below.

    from guietta import Gui
    import time
    
    gui = Gui(
        [["Start"]],
        [["Stop"] ],
        ["Result" ]
        )
    
    def count(*args):
        i = 0
        while True:
            gui.Result = i
            i += 1
            time.sleep(1)
    
    def start_counting(*args):
        gui.execute_in_background(func=count)
    
    def stop_counting(*args):
        pass
    
    gui.Start = start_counting
    gui.Stop = stop_counting
    
    gui.run()
    

    This function just counts the number of seconds since the "Start" button was pressed. This function will continue till it halted by an outside source. Is there some function which can halt the background execution of the count function without halting the entire program?

    opened by jkelowitt 2
  •  How to resize the widgets?????how to resize the QPlainTextEdit??

    How to resize the widgets?????how to resize the QPlainTextEdit??

    I need to resize the components in the GUI window. when I use the resize function:

    edit = gui.QPlainTextEdit edit .resize(800,600)

    but the QPlainTextEdit is still very small!! I cant't resize components??

    opened by unix1024 0
  • www.guietta.com is an ad page?

    www.guietta.com is an ad page?

    Hi,

    First, this project is really awesome! I think it will help a lot introducing GUI programming to a larger audience, specially for scientific software.

    But most important, the www.guietta.com page seems to lead to a weird ad page? Is that intented, or did the domain expire or something similar? From a quick search in name and namecheap it seems to be the case. Would it be possible to maybe remove it from the about section of the repo? Thanks for your attention,

    opened by endarthur 1
  • Cannot use M() widgets with Matplotlib version 2.x

    Cannot use M() widgets with Matplotlib version 2.x

    >>> import matplotlib
    >>> matplotlib.__version__
    '2.0.2'
    >>> from guietta  import Gui, M
    >>> a= Gui([M('a')])
    ValueError: Element (<guietta.guietta_matplotlib.MatplotlibWidget object at 0x7f6a6f74bca8>, 'a') must be a widget or a (widget, name) tuple
    

    Same code with matplotlib v3.x works. Apparently the problem is that the FigureCanvas widget is a QWidget in matplotlib v3.x, but not in matplotlib v2.x

    opened by alfiopuglisi 0
  • HOW TO AlignTop a subgui

    HOW TO AlignTop a subgui

    Hi!

    Operating System: Windows 8.1 Python version: Python 3.7.4 guietta Port and Version: guietta 0.3.8 Code or partial code causing the problem:

    1. How do I AlignTop a subgui? How do I implement AlignTop with the parent main.layout() as default or directly to the subgui.layout()? Please see attached screenshot.
    

    Thank you.

    image

    opened by virbcal 1
  • Replacing Subgui with another Subgui

    Replacing Subgui with another Subgui

    I'm trying to make a gui which has a sub-gui section which changes based on user interaction. For example, the code below:

    from guietta import Gui, C, R, III, VS, HS, _, ___, G
    
    main = Gui( [G("Inner GUI") , ["Get Subgui1"]],
                [ III           , ["Get Subgui2"]])
    
    
    subgui1 = Gui([C('First') , '__First__'],
                  [R('First')  , ['button1!']])
    
    subgui2 = Gui([VS("Gui 2 Slider") , HS("Gui 2 Slider"), ___],
                  [III                , _                 , _  ])
    
    with main.GetSubgui1:
        if main.is_running:
            main.InnerGUI = subgui1
    
    with main.GetSubgui2:
        if main.is_running:
            main.InnerGUI = subgui2
    
    main.run()
    

    "subgui1" is shown in the groupbox "Inner GUI" if the appropriate button is pressed. The same is true for "subgui2". On the first press of either option, the appropriate subgui is shown. Pressing the other button after the first subgui has been shown results in no change.

    I would expect that clicking on the second button would replace the subgui which is already in the groupbox.

    "subgui2" will not show after "subgui1" has been selected. BqW0yZW

    "subgui1" will not show after "subgui2" has been selected. mYGzf75

    opened by jkelowitt 2
Tkinter Designer - Create Beautiful Tkinter GUIs by Drag and Drop.

Tkinter Designer is created to speed up and beautify Python GUI Experience. It uses well know design software called Figma. Which makes creating Tkinter GUI in Python a piece of cake.

Parth Jadhav 5.2k Jan 9, 2023
Generate multifunctional GUIs from classes

magic-class In magicgui you can make simple GUIs from functions. However, we usually have to create GUIs that are composed of several buttons, and eac

null 25 Dec 15, 2022
A little Python library for making simple Electron-like HTML/JS GUI apps

Eel Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries. Ee

Chris Knott 5.4k Jan 7, 2023
🧮A simple calculator written in python allows you to make simple calculations, write charts, calculate the dates, and exchange currency.

Calculator ?? A simple calculator written in python allows you to make simple calculations, write charts, calculate the dates, and exchange currency.

Jan Kupczyk 1 Jan 15, 2022
A simple yet powerful TUI framework for your Python (3.7+) applications

A simple yet powerful TUI framework for your Python (3.7+) applications

null 1.4k Jan 4, 2023
PyEditor - A Simple Text Editor for python

PyEditor work in progress Text Editor for python Installation git clone https://github.com/ArmenG888/PyEditor Install the libraries Linux or mac pip

ArmenG 3 Mar 15, 2022
A simple alarm-clock created using Python and Kivy.

Alarm-Clock made with Python and Kivy. A simple alarm-clock created using Python and Kivy. See the time. Set a maximum of 5 alarms. Cancel alarms. Not

Caio 2 Jul 31, 2022
Simple GUI python app to show a stocks graph performance. Made with Matplotlib and Tiingo.

stock-graph-python Simple GUI python app to show a stocks graph performance. Made with Matplotlib and Tiingo. Tiingo API Key You will need to add your

Toby 12 May 14, 2022
A simple desktop news application written using python created using PyQt5

News-Application---Python This is a news application created using PyQt5. News is fetched through API from newsapi.org. Available top headlines from c

Sritiman Adak 1 Nov 14, 2021
A simple Python Module for sending cross-platform desktop notifications on Windows, macOS and Linux

notify.py Cross platform desktop notifications for Python scripts and applications. Docs You can read the docs on this Git's Wiki, or here Supported P

Mustafa 178 Dec 26, 2022
A simple GUI designer for the python tkinter module

Leer en Español Welcome to Pygubu! Pygubu is a RAD tool to enable quick and easy development of user interfaces for the Python's tkinter module. The u

Alejandro Autalán 1.7k Dec 27, 2022
Win32mica: a simple module to add the Mica effect on legacy python windows.

Win32mica (aka PyMica): A simple module to add the Mica effect on legacy python windows The aim of this project is to apply the Mica effect on python

Martí Climent 40 Dec 13, 2022
Chatterpatter - A simple GUI complex backend Chat Application made using python

Chatterpatter - A simple GUI complex backend Chat Application made using python

Gurneet Singh 2 Jan 8, 2022
A very simple calculator with a modern UI made in Python thanks for the stunning Sun-Valley-ttk-theme and Segoe UI Variable font.

Fluent-Python-Calculator A simple Python calculator with Sun-Valley-ttk-theme About Fluent-Python-Calculator: A very simple calculator with a modern U

null 59 Dec 6, 2022
This simple python program can be used to make FontChooser dialog in Tkinter Applications.

tkFontBox This simple python program can be used to make FontChooser dialog in Tkinter Applications. how to use? Copy the tkFontBox.py file into your

Pawan Kumar Prachi 1 Feb 8, 2022
LyricsGenerator - A simple GUI made using Python(Tkinter) for generating song lyrics

Lyrics Generator Reference :- https://www.geeksforgeeks.org/create-a-gui-to-extr

Somya Ranjan Sahu 3 Mar 25, 2022
GUI for Volatility forensics tool written in PyQT5

Volatility GUI This is a GUI for Volatility forensics tool written in PyQT5 Prerequisites: 1- Installed version of Volatility. 2- Install PyQT5. sudo

Hamza Megahed 52 Jun 18, 2022
A tf publisher gui tool for ROS, which publish /tf_static message. The software is based on PyQt5.

tf_publisher_gui for ROS Introduction How to use cd catkin_ws/src git clone https://github.com/yinwu33/tf_publisher_gui.git cd catkin_ws catkin_make s

yinwu33 7 Dec 28, 2022
OpenPort scanner GUI tool (CNMAP)

CNMAP-GUI- OpenPort scanner GUI tool (CNMAP) as you know it is the advanced tool to find open port, firewalls and we also added here heartbleed scanni

null 9 Mar 5, 2022