{"id":22051955,"url":"https://github.com/zachbateman/easy_gui","last_synced_at":"2025-05-11T04:26:59.508Z","repository":{"id":42776481,"uuid":"191872731","full_name":"zachbateman/easy_gui","owner":"zachbateman","description":"Tool designed to help quickly build powerful Python tkinter GUI applications","archived":false,"fork":false,"pushed_at":"2023-03-22T00:56:54.000Z","size":225,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T19:03:07.442Z","etag":null,"topics":["gui","python","tkinter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zachbateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-14T03:54:12.000Z","updated_at":"2024-11-26T15:28:24.000Z","dependencies_parsed_at":"2023-01-21T14:46:48.349Z","dependency_job_id":null,"html_url":"https://github.com/zachbateman/easy_gui","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachbateman%2Feasy_gui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachbateman%2Feasy_gui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachbateman%2Feasy_gui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachbateman%2Feasy_gui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachbateman","download_url":"https://codeload.github.com/zachbateman/easy_gui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518953,"owners_count":21921074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","python","tkinter"],"created_at":"2024-11-30T15:12:25.351Z","updated_at":"2025-05-11T04:26:59.491Z","avatar_url":"https://github.com/zachbateman.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy_gui\n\neasy_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!\n\n\n# Features\n\n  - Quickly and easily build a GUI by subclassing easy_gui.EasyGUI\n  - Add easy_gui Widget objects (check out widgets.py for details on each):\n    - Button, CanvasButton, Label, Entry, LabelEntry, CheckBox, DropDown, ListBox, Table, Tree, Slider, MatplotlibPlot, Canvas, ProgressBar, ScrolledText, StdOutBox, DatePicker\n  - Create one or more Sections (including nested Sections) to help organize GUI elements\n  - CSS Grid-style layouts\n  - Simply create a popup window using EasyGUI.popup()\n  - Simply create popup tooltips for widgets using Widget.add_tooltip()\n  - Multithreading for GUI responsiveness (set \"separate_thread=True\" when creating a Button Widget)\n  - Easy to install with few dependancies - just matplotlib (but you want to make plots anyway, right?!)\n\n\n# Quickstart\n\n  - Installing easy_gui is easy enough.  Simply use pip:\n  ```\n  pip install easy_gui\n  ```\n\n  - To create an application with easy_gui, subclass the easy_gui.EasyGUI class and add elements in the init method.\n\n  - Here is the most simple example:\n  ```\n  import easy_gui\n\n  class GUI(easy_gui.EasyGUI):\n      def __init__(self):\n          self.add_widget(type='label', text='Example Label')\n          self.add_widget(type='button', text='Button', command_func=lambda x: print('TEST'))\n\n  application = GUI()\n  ```\n  \u003cimg src=\"examples/super_simple_gui.png\" width=\"200px\"\u003e\n\n\n  - 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:\n  ```\n  import easy_gui\n\n  class GUI(easy_gui.EasyGUI):\n      def __init__(self):\n          self.title('Animal Diet Generator')\n          self.geometry(\"425x170\")\n\n          section = self.add_section('example_section')\n          section.configure_grid(['title             title         output',\n                                  'label1            entry1        output',\n                                  'label2            entry2        output',\n                                  'run_button      run_button      output'])\n          section.add_widget(type='label', text='Animal Diet Generator!', grid_area='title')\n          section.add_widget(type='label', text='Animal:', grid_area='label1')\n          self.animal = section.add_widget(type='entry', grid_area='entry1')\n          section.add_widget(type='label', text='Food:', grid_area='label2')\n          self.food = section.add_widget(type='entry', grid_area='entry2')\n          section.add_widget(type='stdout', grid_area='output')\n          section.add_widget(type='button', text='Generate Diet!', grid_area='run_button', command_func=self.diet)\n\n      def diet(self, event):\n          print(f'The {self.animal.get()} likes to eat {self.food.get()}!')\n\n  application = GUI()\n  ```\n  \u003cimg src=\"examples/simple_gui.png\" width=\"425px\"\u003e\n\n\n# More Firepower\n\nThe toy examples above show the basics for getting started.  Below is a more robust example for what a simple tool could look like.\nThis example highlights a number of powerful features such as:\n  - CSS-style grid layouts (literally make a picture of what you want to see with a list of strings)\n  - Flexible, high-level Widgets that are quick to add or manipulate\n  - Quick and easy popup window using `with self.popup() as popup:`\n\n  \u003cimg src=\"examples/moderate_gui.png\" width=\"800px\"\u003e\n\n  ```\nimport easy_gui\nimport random\nfrom matplotlib.figure import Figure\n\n\nclass GUI(easy_gui.EasyGUI):\n    def __init__(self):\n        self.title('Data Generator')\n        self.geometry(\"800x550\")\n\n        self.configure_grid(['check   data_gen   info',\n                                   'tree       tree        data',\n                                   'tree       tree        plot'])\n\n        self.parabolic = self.add_widget('checkbox', 'Parabolic Data', grid_area='check')\n        self.add_widget('btn', 'Generate New Data', grid_area='data_gen', use_ttk=True, command_func=self.generate_data)\n        self.add_key_trigger('new', self.generate_data)\n        print('Also can generate new data by simply typing \"new\"!')\n\n        info = self.add_section(grid_area='info')\n        info.configure_grid([' .        title     . ',\n                                   'mean   min  max'])\n        info.add_widget('lbl', 'Data Information', underline=True, bold=True, grid_area='title')\n        self.mean = info.add_widget('lbl', 'Mean:', grid_area='mean')\n        self.min = info.add_widget('lbl', 'Minimum:', grid_area='min')\n        self.max = info.add_widget('lbl', 'Maximum:', grid_area='max')\n\n        self.tree = self.add_widget('tree', grid_area='tree', height=10)\n        self.tree.bind_select(self.refresh_display)\n\n        self.table = self.add_widget('table', rows=2, columns=11, border=True, grid_area='data')\n        self.table[1, 1] = 'X Values'\n        self.table[2, 1] = 'Y Values'\n\n        self.plot = self.add_widget('matplotlib', grid_area='plot')\n\n        self.add_menu(commands={}, cascades={'Data': {'Save Data to CSV': self.save_data}})\n\n        self.data_sets = []  # store all generated datasets in this list\n        self.generate_data()  # start with one initial dataset\n\n\n    def current_data(self):\n        name, x_vals, y_vals = [tup for tup in self.data_sets if tup[0] == self.tree.current_row['text']][0]\n        return name, x_vals, y_vals\n\n    def refresh_tree(self, *args):\n        self.tree.clear()\n        for name, x_vals, y_vals in self.data_sets:\n            self.tree.insert_row(name)\n        self.tree.select_first_row()\n        self.refresh_display()\n\n    def refresh_display(self, *args):\n        name, x_vals, y_vals = self.current_data()\n\n        # Update summary info at top\n        self.mean.set(f'Mean: {round(sum(y_vals) / len(y_vals), 1)}')\n        self.min.set(f'Minimum: {min(y_vals)}')\n        self.max.set(f'Maximum: {max(y_vals)}')\n\n        # Update table with current data\n        for index, (x, y) in enumerate(zip(x_vals, y_vals)):\n            self.table[1, index+2] = x\n            self.table[2, index+2] = y\n\n        # Update the plot\n        fig = Figure(figsize=(5, 3), dpi=100)\n        ax = fig.add_subplot(111)\n        ax.set_title('Plot of X and Y Values')\n        ax.scatter(x_vals, y_vals)\n        self.plot.draw_plot(mpl_figure=fig)\n\n    def generate_data(self, *args):\n        x_vals = list(range(1, 11))\n        if not self.parabolic.get():\n            y_vals = [round(x + random.random() * 2, 1) for x in x_vals]\n        else:\n            y_vals = [round((x - 5 + random.random()) ** 2, 1) for x in x_vals]\n        self.data_sets.append((f'Dataset {len(self.data_sets)+1}' + (' (Parabolic)' if self.parabolic.get() else ''), x_vals, y_vals))\n        self.refresh_tree()\n\n        with self.popup() as popup:\n            popup.geometry('200x80')\n            popup.add_widget('lbl', 'New data generated!', bold=True)\n\n    def save_data(self, *args):\n        with open('Moderate GUI Data.csv', 'w') as f:\n            f.write('Dataset,X_Values,Y_Values\\n')\n            for name, x_vals, y_vals in self.data_sets:\n                for x, y in zip(x_vals, y_vals):\n                    f.write(f'{name},{x},{y}\\n')\n        print('Data saved to CSV file!')\n\n\n\nif __name__ == '__main__':\n    GUI()\n  ```\n\n\n\nLicense\n----\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachbateman%2Feasy_gui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachbateman%2Feasy_gui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachbateman%2Feasy_gui/lists"}