Skip to main content

Easy Python tkinter applications

Project description

easy_gui

easy_gui is a high-level Python library designed to simplify the process of creating GUI applications by wrapping tkinter. Solving problems is tricky enough... using our solutions should be easy!

Quickstart

  • Installing easy_gui is easy enough. Simply use pip:
pip install easy_gui
  • To create an application with easy_gui, subclass the easy_gui.EasyGUI class and add elements in the init method.

  • Here is the most simple example:

import easy_gui

class GUI(easy_gui.EasyGUI):
    def __init__(self):
        section = self.add_section('example', return_section=True)
        section.add_widget(type='label', text='Example Label')
        section.add_widget(type='button', text='Button', command_func=lambda x: print('TEST'))

application = GUI()
  • Now for a more substantial example that also shows CSS-style layout capabilities. See the script examples/simple_gui.py for this code with additional explanatory comments:
import easy_gui

class GUI(easy_gui.EasyGUI):
    def __init__(self):
        self.title('Animal Diet Generator')
        self.geometry("425x170")

        section = self.add_section('example_section', return_section=True)
        section.configure_grid(['title             title         output',
                                'label1            entry1        output',
                                'label2            entry2        output',
                                'run_button      run_button      output'])
        section.add_widget(type='label', text='Animal Diet Generator!', grid_area='title')
        section.add_widget(type='label', text='Animal:', grid_area='label1')
        self.animal = section.add_widget(type='entry', grid_area='entry1', return_widget=True)
        section.add_widget(type='label', text='Food:', grid_area='label2')
        self.food = section.add_widget(type='entry', grid_area='entry2', return_widget=True)
        section.add_widget(type='stdout', grid_area='output')
        section.add_widget(type='button', text='Generate Diet!', grid_area='run_button', command_func=self.diet)

    def diet(self, event):
        print(f'The {self.animal.get()} likes to eat {self.food.get()}!')

application = GUI()

Current Features

  • Quickly and easily build a GUI by subclassing the easy_gui.EasyGUI class.
  • Create one or more Sections to organize GUI elements.
  • Add easy_gui Widget objects to Sections:
    • Button, Label, Entry, CheckBox, DropDown, ListBox, Tree, MatplotlibPlot, StdOutBox, ScrolledText
  • CSS Grid-style layouts.
  • Easily use multithreading for GUI responsiveness (set "separate_thread=True" when creating a Button Widget)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_gui-0.1.0.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

easy_gui-0.1.0-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page