Launched in 2018 Actively developed and supported. Supports tkinter, Qt, WxPython, Remi (in browser). Create custom layout GUI's simply. Python 2.7 & 3 Support. 200+ Demo programs & Cookbook for rapid start. Extensive documentation. Examples using Machine Learning(GUI, OpenCV Integration, Chatterbot), Floating Desktop Widgets, Matplotlib + Pyplot integration, add GUI to command line scripts, PDF & Image Viewer. For both beginning and advanced programmers .

Overview

Python GUIs for Humans

Python GUIs for Humans

Transforms the tkinter, Qt, WxPython, and Remi (browser-based) GUI frameworks into a simpler interface. The window definition is simplified by using Python core data types understood by beginners (lists and dictionaries). Further simplification happens by changing event handling from a callback-based model to a message passing one.

Your code is not required to have an object oriented architecture which makes the package usable by a larger audience. While the architecture is simple to understand, it does not necessarily limit you to only simple problems.

Some programs are not well-suited for PySimpleGUI however. By definition, PySimpleGUI implements a subset of the underlying GUI frameworks' capabilities. It's difficult to define exactly which programs are well suited for PySimpleGUI and which are not. It depends on the details of your program. Duplicating Excel in every detail is an example of something not well suited for PySimpleGUI.

Japanese version of this readme.

Buy Me A Coffee

I could use a coffee! It fuels consultants, editors, domain registration and so many other things required for PySimpleGUI to be a thriving project.


Statistics πŸ“ˆ

PyPI Installs

tkinter tkinter 2.7
Qt WxPython Web (Remi)

GitHub

img img img img img img

Most Recent PyPI Version

tkinter img Qt img Web img WxPython img


What Is PySimpleGUI ❓

PySimpleGUI is a Python package that enables Python programmers of all levels to create GUIs. You specify your GUI window using a "layout" which contains widgets (they're called "Elements" in PySimpleGUI). Your layout is used to create a window using one of the 4 supported frameworks to display and interact with your window. Supported frameworks include tkinter, Qt, WxPython, or Remi. The term "wrapper" is sometimes used for these kinds of packages.

Your PySimpleGUI code is simpler and shorter than writing directly using the underlying framework because PySimpleGUI implements much of the "boilerplate code" for you. Additionally, interfaces are simplified to require as little code as possible to get the desired result. Depending on the program and framework used, a PySimpleGUI program may require 1/2 to 1/10th amount of code to create an identical window using one of the frameworks directly.

While the goal is to encapsulate/hide the specific objects and code used by the GUI framework you are running on top of, if needed you can access the frameworks' dependent widgets and windows directly. If a setting or feature is not yet exposed or accessible using the PySimpleGUI APIs, you are not walled off from the framework. You can expand capabilities without directly modifying the PySimpleGUI package itself.

Bridging the "GUI Gap"

Python has brought a large number of people into the programming community. The number of programs and the range of areas it touches is mindboggling. But more often than not, these and technologies are out of reach of all but a handful of people. The majority of Python programs are "command line" based. This isn't a problem for programmer-types as we're all used to interacting with computers through a text interface. While programmers don't have a problem with command-line interfaces, most "normal people" do. This creates a digital divide, a "GUI Gap".

Adding a GUI to a program opens that program up to a wider audience. It becomes more approachable. GUIs can also make interacting with some programs easier, even for those that are comfortable with a command-line interface. And finally, some problems require a GUI.


About Me πŸ‘‹

Hi there! I'm Mike. You'll find me right here, on the PySimpleGUI GitHub, solving problems and continuously pushing PySimpleGUI forward. I've dedicated my days, nights, and weekends to the project and PySimpleGUI users. Our successes are ultimately shared. I'm successful when you're successful.

While a relative newcomer to Python, I've been writing software since the 70s. The majority of my career was spent creating products in Silicon Valley. I bring to PySimpleGUI the same professionalism and dedication as I did to the corporate products I developed. You are my customers now.

Project Goals πŸ₯…

Two of the more important goals of the PySimpleGUI project:

  • Having fun
  • Your success

Fun as a goal on a serious project sounds odd, but it's a serious goal. I find writing these GUI programs to be a lot of fun. One reason is how little time it takes to write a complete solution. If we're not enjoying the process then someone's going to give up.

There is a significant amount of documentation, a cookbook, 100's of demo programs to get you immediately running, a detailed call reference, YouTube videos, online Trinket demos, and more... all working to create... a fun experience.

Your Success is a shared goal. PySimpleGUI was built for developers. You're my peeps. It's been an unexpected reward to see the results of the combined effort of users and PySimpleGUI. Use the documentation & other materials to help build your application. If you run into trouble, help is available by opening on Issue on the PySimpleGUI GitHub. Take a look at the section on Support below.


Educational Resources πŸ“š

www.PySimpleGUI.org is easy to remember and is where the documentation is located. You'll find tabs across the top that represent several different documents. The documentation is located on "Read The Docs" so that there is a table of contents for each document and they are easy to search.

There are 100s of pages of written documentation and 100s of example programs that will help you be effective very quickly. Rather than requiring days or weeks of investment to learn a single GUI package, you may be able to complete your project in a single afternoon when using PySimpleGUI.

Example 1 - The One-Shot Window

This type of program is called a "one-shot" window because the window is displayed one time, the values collected, and then it is closed. It doesn't remain open for a long time like you would in a Word Processor.

Anatomy of a Simple PySimpleGUI Program

There are 5 sections to a PySimpleGUI program

import PySimpleGUI as sg                        # Part 1 - The import

# Define the window's contents
layout = [  [sg.Text("What's your name?")],     # Part 2 - The Layout
            [sg.Input()],
            [sg.Button('Ok')] ]

# Create the window
window = sg.Window('Window Title', layout)      # Part 3 - Window Defintion
                                                
# Display and interact with the Window
event, values = window.read()                   # Part 4 - Event loop or Window.read call

# Do something with the information gathered
print('Hello', values[0], "! Thanks for trying PySimpleGUI")

# Finish up by removing from the screen
window.close()                                  # Part 5 - Close the Window

The code produces this window


Example 2 - Interactive Window

In this example, our window will remain on the screen until the user closes the window or clicks the Quit button. The main difference between the one-shot window you saw earlier and an interactive window is the addition of an "Event Loop". The Event Loop reads events and inputs from your window. The heart of your application lives in the event loop.

import PySimpleGUI as sg

# Define the window's contents
layout = [[sg.Text("What's your name?")],
          [sg.Input(key='-INPUT-')],
          [sg.Text(size=(40,1), key='-OUTPUT-')],
          [sg.Button('Ok'), sg.Button('Quit')]]

# Create the window
window = sg.Window('Window Title', layout)

# Display and interact with the Window using an Event Loop
while True:
    event, values = window.read()
    # See if user wants to quit or window was closed
    if event == sg.WINDOW_CLOSED or event == 'Quit':
        break
    # Output a message to the window
    window['-OUTPUT-'].update('Hello ' + values['-INPUT-'] + "! Thanks for trying PySimpleGUI")

# Finish up by removing from the screen
window.close()

This is the window that Example 2 produces.

And here's what it looks like after you enter a value into the Input field and click the Ok button.

Let's take a quick look at some of the differences between this example and the one-shot window.

First, you'll notice differences in the layout. Two changes in particular are important. One is the addition of the key parameter to the Input element and one of the Text elements. A key is like a name for an element. Or, in Python terms, it's like a dictionary key. The Input element's key will be used as a dictionary key later in the code.

Another difference is the addition of this Text element:

          [sg.Text(size=(40,1), key='-OUTPUT-')],

There are 2 parameters, the key we already covered. The size parameter defines the size of the element in characters. In this case, we're indicating that this Text element is 40 characters wide, by 1 character high. Notice that there is no text string specified which means it'll be blank. You can easily see this blank row in the window that's created.

We also added a button, "Quit".

The Event Loop has our familiar window.read() call.

Following the read is this if statement:

    if event == sg.WINDOW_CLOSED or event == 'Quit':
        break

This code is checking to see if the user closed the window by clicking the "X" or if they clicked the "Quit" button. If either of these happens, then the code will break out of the event loop.

If the window wasn't closed nor the Quit button clicked, then execution continues. The only thing that could have happened is the user clicked the "Ok" button. The last statement in the Event Loop is this one:

    window['-OUTPUT-'].update('Hello ' + values['-INPUT-'] + "! Thanks for trying PySimpleGUI")

This statement updates the Text element that has the key -OUTPUT- with a string. window['-OUTPUT-'] finds the element with the key -OUTPUT-. That key belongs to our blank Text element. Once that element is returned from the lookup, then its update method is called. Nearly all elements have an update method. This method is used to change the value of the element or to change some configuration of the element.

If we wanted the text to be yellow, then that can be accomplished by adding a text_color parameter to the update method so that it reads:

    window['-OUTPUT-'].update('Hello ' + values['-INPUT-'] + "! Thanks for trying PySimpleGUI",
                              text_color='yellow')

After adding the text_color parameter this is our new resulting window:

The parameters available for each element are documented in both the call reference documentation as well as the docstrings. PySimpleGUI has extensive documentation to help you understand all of the options available to you. If you lookup the update method for the Text element, you'll find this definition for the call:

As you can see several things can be changed for a Text element. The call reference documentation is a valuable resource that will make programming in PySimpleGUI, uhm, simple.


Layouts Are Funny LOL! πŸ˜†

Your window's layout is a "list of lists" (LOL). Windows are broken down into "rows". Each row in your window becomes a list in your layout. Concatenate together all of the lists and you've got a layout...a list of lists.

Here is the same layout as before with an extra Text element added to each row so that you can more easily see how rows are defined:

layout = [  [sg.Text('Row 1'), sg.Text("What's your name?")],
            [sg.Text('Row 2'), sg.Input()],
            [sg.Text('Row 3'), sg.Button('Ok')] ]

Each row of this layout is a list of elements that will be displayed on that row in your window.

Using lists to define your GUI has some huge advantages over how GUI programming is done using other frameworks. For example, you can use Python's list comprehension to create a grid of buttons in a single line of code.

These 3 lines of code:

import PySimpleGUI as sg

layout = [[sg.Button(f'{row}, {col}') for col in range(4)] for row in range(4)]

event, values = sg.Window('List Comprehensions', layout).read(close=True)

produces this window which has a 4 x 4 grid of buttons:

Recall how "fun" is one of the goals of the project. It's fun to directly apply Python's powerful basic capabilities to GUI problems. Instead of pages of code to create a GUI, it's a few (or often 1) lines of code.

Collapsing Code

It's possible to condense a window's code down to a single line of code. The layout definition, window creation, display, and data collection can all be written in this line of code:

event, values = sg.Window('Window Title', [[sg.Text("What's your name?")],[sg.Input()],[sg.Button('Ok')]]).read(close=True)

The same window is shown and returns the same values as the example showing the sections of a PySimpleGUI program. Being able to do so much with so little enables you to quickly and easily add GUIs to your Python code. If you want to display some data and get a choice from your user, it can be done in a line of code instead of a page of code.

By using short-hand aliases, you can save even more space in your code by using fewer characters. All of the Elements have one or more shorter names that can be used. For example, the Text element can be written simply as T. The Input element can be written as I and the Button as B. Your single-line window code thus becomes:

event, values = sg.Window('Window Title', [[sg.T("What's your name?")],[sg.I()],[sg.B('Ok')]]).read(close=True)

Code Portability

PySimpleGUI is currently capable of running on 4 Python GUI Frameworks. The framework to use is specified using the import statement. Change the import and you'll change the underlying GUI framework. For some programs, no other changes are needed than the import statement to run on a different GUI framework. In the example above, changing the import from PySimpleGUI to PySimpleGUIQt, PySimpleGUIWx, PySimpleGUIWeb will change the framework.

Import Statement Resulting Window
PySimpleGUI
PySimpleGUIQt
PySimpleGUIWx
PySimpleGUIWeb

Porting GUI code from one framework to another (e.g. moving your code from tkinter to Qt) usually requires a rewrite of your code. PySimpleGUI is designed to enable you to enable easy movement between the frameworks. Sometimes some changes are required of you, but the goal is to have highly portable code with minimal changes.

Some features, like a System Tray Icon, are not available on all of the ports. The System Tray Icon feature is available on the Qt and WxPython ports. A simulated version is available on tkinter. There is no support for a System Tray icon in the PySimpleGUIWeb port.

Runtime Environments

Environment Supported
Python Python 3.4+
Operating Systems Windows, Linux, Mac
Hardware Desktop PCs, Laptops, Raspberry Pi, Android devices running PyDroid3
Online repli.it, Trinket.com (both run tkinter in a browser)
GUI Frameworks tkinter, pyside2, WxPython, Remi

Integrations

Among the more than 200 "Demo Programs" you'll find examples of how to integrate many popular Python packages into your GUI.

Want to embed a Matplotlib drawing into your window? No problem, copy the demo code and instantly have a Matplotlib drawing of your dreams into your GUI.

These packages and more are ready for you to put into your GUI as there are demo programs or a demo repo available for each:

Package Description
Matplotlib Many types of graphs and plots
OpenCV Computer Vision (often used for AI)
VLC Video playback
pymunk Physics engine
psutil System environment statistics
prawn Reddit API
json PySimpleGUI wraps a special API to store "User Settings"
weather Integrates with several weather APIs to make weather apps
mido MIDI playback
beautiful soup Web Scraping (GitHub issue watcher example)

Installing πŸ’Ύ

Two common ways of installing PySimpleGUI:

  1. pip to install from PyPI
  2. Download the file PySimpleGUI.py and place in your application's folder

Pip Installing & Upgrading

The current suggested way of invoking the pip command is by running it as a module using Python. Previously the command pip or pip3 was directly onto a command-line / shell. The suggested way

Initial install for Windows:

python -m pip install PySimpleGUI

Initial install for Linux and MacOS:

python3 -m pip install PySimpleGUI

To upgrade using pip you simply 2 parameters to the line --upgrade --no-cache-dir.

Upgrade installation on Windows:

python -m pip install --upgrade --no-cache-dir PySimpleGUI

Upgrade for Linux and MacOS:

python3 -m pip install --upgrade --no-cache-dir PySimpleGUI

Single File Installing

PySimpleGUI was created as a single .py file so that it would be very easy for you to install it, even on systems that are not connected to the internet like a Raspberry Pi. It's as simple as placing the PySimpleGUI.py file into the same folder as your application that imports it. Python will use your local copy when performing the import.

When installing using just the .py file, you can get it from either PyPI or if you want to run the most recent unreleased version then you'll download it from GitHub.

To install from PyPI, download either the wheel or the .gz file and unzip the file. If you rename the .whl file to .zip you can open it just like any normal zip file. You will find the PySimpleGUI.py file in one of the folders. Copy this file to your application's folder and you're done.

The PyPI link for the tkinter version of PySimpleGUI is: https://pypi.org/project/PySimpleGUI/#files

The GitHub repo's latest version can be found here: https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/PySimpleGUI.py

Now some of you are thinking, "yea, but, wait, having a single huge source file is a terrible idea". And, yea, sometimes it can be a terrible idea. In this case, the benefits greatly outweighed the downside. Lots of concepts in computer science are tradeoffs or subjective. As much as some would like it to be, not everything is black and white. Many times the answer to a question is "it depends".

Galleries 🎨

Work on a more formal gallery of user-submitted GUIs as well as those found on GitHub is underway but as of this writing is not complete. There are currently 2 places you can go to see some screenshots in a centralized way. Hopefully, a Wiki or other mechanism can be released soon to do justice to the awesome creations people are making.

User Submitted Gallery

The first is a user submitted screenshots issue located on the GitHub. It's an informal way for people to show off what they've made. It's not ideal, but it was a start.

Massive Scraped GitHub Images

The second is a massive gallery of over 3,000 images scraped from 1,000 projects on GitHub that are reportedly using PySimpleGUI. It's not been hand-filtered and there are plenty of old screenshots that were used in the early documentation. But, you may find something in there that sparks your imagination.


Uses for PySimpleGUI πŸ”¨

The following sections showcase a fraction of the uses for PySimpleGUI. There are over 1,000 projects on GitHub alone that use PySimpleGUI. It's truly amazing the possibilities that have opened up for so many people. Many users have spoken about previously attempting to create a GUI in Python and failing, but finally achieving their dreams when they tried PySimpleGUI.

Your First GUI

Of course one of the best uses of PySimpleGUI is getting you into making GUIs for your Python projects. You can start as small as requesting a filename. For this, you only need to make a single call to one of the "high-level functions" called popup. There are all kinds of popups, some collect information.

popup but itself makes a window to display information. You can pass multiple parameters just like a print. If you want to get information, then you will call functions that start with popup_get_ such as popup_get_filename.

Adding a single line to get a filename instead of specifying a filename on the command line can transform your program into one that "normal people" will feel comfortable using.

import PySimpleGUI as sg

filename = sg.popup_get_file('Enter the file you wish to process')
sg.popup('You entered', filename)

This code will display 2 popup windows. One to get the filename, which can be browsed to or pasted into the input box.

img

The other window will output what is collected.

img


Rainmeter-Style Windows

img The default settings for GUI frameworks don't tend to produce the nicest looking windows. However, with some attention to detail, you can do several things to make windows look attractive. PySimpleGUI makes it easier to manipulate colors and features like removing the title bar. The result is windows that don't look like your typical tkinter windows.

Here is an example of how you can create windows that don't look like your typical tkinter in windows. In this example, the windows have their titlebars removed. The result is windows that look much like those found when using Rainmeter, a desktop widget program.



You can easily set the transparency of a window as well. Here are more examples of desktop widgets in the same Rainmeter style. Some are dimmed appearing because they are semi-transparent. img

Both of these effects, removing the titlebar and making a window semi-transparent, are achieved by setting 2 parameters when creating the window. This is an example of how PySimpleGUI enables easy access to features. And because PySimpleGUI code is portable across the GUI frameworks, these same parameters work for the other ports such as Qt.

Changing the Window creation call in Example 1 to this line of code produces a similar semi-transparent window:

window = sg.Window('My window', layout, no_titlebar=True, alpha_channel=0.5)

Games

While not specifically written as a game development SDK, PySimpleGUI makes the development of some games quite easy.

img This Chess program not only plays chess, but it integrates with the Stockfish chess-playing AI.










img Several variants of Minesweeper have been released by users.










img









img

Card games work well with PySimpleGUI as manipulating images is simple when using the PySimpleGUI Graph element.

While not specifically written as a game development SDK, PySimpleGUI makes development of some games quite easy.






Media Capture and Playback

img

Capturing and displaying video from your webcam in a GUI is 4 lines of PySimpleGUI code. Even more impressive is that these 4 lines of code work with the tkinter, Qt, and Web ports. You can display your webcam, in realtime, in a browser using the same code that displays the image using tkinter.

Media playback, audio and video, can also be achieved using the VLC player. A demo application is provided to you so that you have a working example to start from. Everything you see in this readme is available to you as a starting point for your own creations.











Artificial Intelligence

img

AI and Python have long been a recognized superpower when the two are paired together. What's often missing however is a way for users to interact with these AI algorithms familiarly, using a GUI.

These YOLO demos are a great example of how a GUI can make a tremendous difference in interacting with AI algorithms. Notice two sliders at the bottom of these windows. These 2 sliders change a couple of the parameters used by the YOLO algorithm.

If you were tuning your YOLO demo using only the command line, you would need to set the parameters, once, when you launch the application, see how they perform, stop the application, change the parameters, and finally restart the application with the new parameters.



img

Contrast those steps against what can be done using a GUI. A GUI enables you to modify these parameters in real-time. You can immediately get feedback on how they are affecting the algorithm.








img

There are SO many AI programs that have been published that are command-line driven. This in itself isn't a huge hurdle, but it's enough of a "pain in the ass" to type/paste the filename you want to colorize on the command line, run the program, then open the resulting output file in a file viewer.

GUIs have the power to change the user experience, to fill the "GUI Gap". With this colorizer example, the user only needs to supply a folder full of images, and then click on an image to both colorize and display the result.

The program/algorithm to do the colorization was freely available, ready to use. What was missing is the ease of use that a GUI could bring.


Graphing

img

Displaying and interacting with data in a GUI is simple with PySimpleGUI. You have several options.

You can use the built-in drawing/graphing capabilities to produce custom graphs. This CPU usage monitor uses the Graph element





img

Matplotlib is a popular choice with Python users. PySimpleGUI can enable you to embed Matplotlib graphs directly into your GUI window. You can even embed the interactive controls into your window if you want to retain the Matplotlib interactive features.









img Using PySimpleGUI's color themes, you can produce graphs that are a notch above default graphs most people create in Matplotlib.
















Front-ends

img

The "GUI Gap" mentioned earlier can be easily solved using PySimpleGUI. You don't even need to have the source code to the program you wish to add a GUI onto. A "front-end" GUI is one that collects information that is then passed to a command-line application.

Front-end GUIs are a fantastic way for a programmer to distribute an application that users were reluctant to use previously because they didn't feel comfortable using a command-line interface. These GUIs are your only choice for command-line programs that you don't have access to the source code for.

This example is a front-end for a program called "Jump Cutter". The parameters are collected via the GUI, a command-line is constructed using those parameters, and then the command is executed with the output from the command-line program being routed to the GUI interface. In this example, you can see in yellow the command that was executed.


Raspberry Pi

img

Because PySimpleGUI is compatible back to Python 3.4 it is capable of creating a GUI for your Raspberry Pi projects. It works particularly well when paired with a touchscreen. You can also use PySimpleGUIWeb to control your Pi if it doesn't have a monitor attached.











Easy Access to Advanced Features

img

Because it's very easy to access many of the underlying GUI frameworks' features, it's possible to piece together capabilities to create applications that look nothing like those produced using the GUI framework directly.

For example, it's not possible to change the color/look-and-feel of a titlebar using tkinter or the other GUI packages, but with PySimpleGUI it's easy to create windows that appear as if they have a custom titlebar.


img

Unbelievably, this window is using tkinter to achieve what appears to be something like a screensaver.

On windows, tkinter can completely remove the background from your application. Once again, PySimpleGUI makes accessing these capabilities trivial. Creating a transparent window requires adding a single parameter to the call that creates your Window. One parameter change can result in a simple application with this effect:

You can interact with everything on your desktop, clicking through a full-screen window.


Themes

Tired of the default grey GUIs? PySimpleGUI makes it trivial for your window to look nice by making a single call to the theme function. There are over 150 different color themes available for you to choose:

img

With most GUI frameworks, you must specify the color for every widget you create. PySimpleGUI takes this chore from you and will automatically color the Elements to match your chosen theme.

To use a theme, call the theme function with the name of the theme before creating your window. You can add spaces for readability. To set the theme to "Dark Grey 9":

import PySimpleGUI as sg

sg.theme('dark grey 9')

This single line of code changes the window's appearance entirely:

img

The theme changed colors of the background, text, input background, input text, and button colors. In other GUI packages to change color schemes like this, you would need to specify the colors of each widget individually, requiring numerous changes to your code.


Support πŸ’ͺ

Your first stop should be the documentation and demo programs. If you still have a question or need help... no problem... help is available to you, at no cost. Simply file an Issue on the PySimpleGUI GitHub repo and you'll get help.

Nearly all software companies have a form that accompanies bug reports. It's not a bad trade... fill in the form, get free software support. This information helps get you an answer efficiently.

In addition to requesting information such as the version numbers of PySimpleGUI and underlying GUI frameworks, you're also given a checklist of items that may help you solve your problem.

Please fill in the form. It may feel pointless to you. It may feel painful, despite it taking just a moment. It helps get you a solution faster. If it wasn't useful and necessary information to help you get a speedy reply and fix, you wouldn't be asked to fill it out. "Help me help you".

Supporting img

Financial support for the project is greatly appreciated. To be honest, financial help is needed. It's expensive just keeping the lights on. The domain name registrations, a long list of subscriptions for things like Trinket, consulting help, etc., quickly add up to a sizable recurring cost.

PySimpleGUI wasn't inexpensive to create. While a labor of love, it was very laborious. It's required over 2 years of working 7-days a week to get the software and documentation to the level you see today.

PySimpleGUI has an open-source license and it would be great if it could remain that way. If you or your company (especially if you're using PySimpleGUI in a company) are benefiting financially by using PySimpleGUI, you have the capability of extending the life of the project for you and other users.

Buy Me A Coffee

Buy Me a Coffee is a great way to publicly support developers. It's quick, easy, and your contribution is recorded so that others can see that you're a supporter of PySimpleGUI. You can also choose to make your donation private.

Buy Me A Coffee

GitHub Sponsoring

The GitHub recurring sponsorship is how you can sponsor the project at varying levels of support on an ongoing basis. It's how many Open Source developers are able to receive corporate level sponsorship.

Your help in financially contributing to the project would be greatly appreciated. Being an Open Source developer is financially challenging. YouTube video creators are able to make a living creating videos. It's not so easy yet for Open Source developers.

Funding - Your help is needed

A frank discussion is needed here. Subtle hasn't worked.

The financial part of Open Source development is not openly discussed often. As an Open Source developer, there is no automatic form of incoming happening, especially with Python where the source code essentially has to be provided. Creating and administrating a Commercial License is expensive. It's a big hurdle to take a project from an Open Source License to a Commercial License. The attorneys I've spoken with haven't heard of it happening successfully. So, licensing is not a practical option.

It's expensive to operate an active Open Source project. The labor involved is massive. How does it get paid for? Well, it comes from the developer is how. Just like YouTube creators have expenses for camera equipment and time making their content and need supporters in order to operate, so do Open Source developers.

PySimpleGUI needs your help. Without some kind of funding, this project will end, likely sooner than later. The individuals with the most ability to make a financial contribution are Corporate Users. It's not tremendously difficult nor does it pose a financial hardship on someone working for a company to make a donation to PySimpleGUI. You're spending someone else's money. If you get a paycheck from a corporation and you're using PySimpleGUI, you're a "corporate user". It doesn't matter if PySimpleGUI is shipping in a product you sell. Your company is benefitting by running PySimpleGUI. If it wasn't, you wouldn't be using it. The person at your company that can help the PySimpleGUI effort is you, the user. Your CFO isn't going to automatically make a payment. Your legal team isn't on the lookout for Open Source projects to help. I've not struck licensing deals with your company, or any company. It's you, the end user that is the person at your company that will need to take action and has the ability to help the project continue.

This PySimpleGUI software isn't the output from an AI bot. Nor is the support for users that are using it. There's a software developer (with a help from some very kind, friendly, generous people) that's doing all this work. I do it because I love creating and enabling people to do cool things. But that love doesn't pay bills. The energy put into the project doesn't create electricity. I make stuff, electricity isn't one of them.

Patreon works well for YouTubers. It typically fails miserably for developers. But there are multiple mechanisms available including PayPal, GitHub sponsorship, and BuyMeACoffee. They all work pretty well and take 2 minutes, if that. One thing it requires is action on the part of the PySimpleGUI user. If you can't afford to help, it's OK. Use the software for free. Make cool stuff. Make the world a better, easier to use place. If you can afford to help, please consider donating to the project. It's for a good cause.

To everyone that's helped, in whatever fashion, I'm very very grateful. And thanks to everyone that takes a moment to say "thank you", it's a small price to pay and adds to the project's momentum.

Contributing πŸ‘·

While PySimpleGUI is currently licensed under an open-source license, the project itself is structured like a proprietary product. Pull Requests are not accepted.

One of the best ways for you to contribute code is to write and publish applications. Users are inspired by seeing what other users build. Create a GitHub repo from, post the code, and include a screenshot in your repo's readme file.

If there is a feature missing that you need or you have an enhancement to suggest, then open an Issue

Special Thanks πŸ™

This version of the PySimpleGUI readme wouldn't have come together without the help from @M4cs. He's a fantastic developer and has been a PySimpleGUI supporter since the project's launch. @israel-dryer is another long-term supporter and has written several PySimpleGUI programs that pushed the envelope of the package's capabilities. The unique minesweeper that uses an image for the board was created by Israel. @jason990420 surprised many when he published the first card game using PySimpleGUI that you see pictured above as well as the first minesweeper game made with PySimpleGUI. The Japanese version of the readme was greatly improved with help from @okajun35.

The more than 1,200 GitHub repos that use PySimpleGUI are owed a "Thank You" as well, for it is you that has been the inspiration that fuels this project's engine.

The overseas users that post on Twitter overnight are the spark that starts the day's work on PySimpleGUI. They've been a source of positive energy that gets the development engine started and ready to run every day. As a token of appreciation, this readme file has been translated into Japanese.

You've all been the best user community an Open Source developer could hope for.

Β© Copyright 2020 PySimpleGUI.org

Comments
  • Window management?

    Window management?

    Hey. I'm sure I'm doing something completely wrong but I need to have windows pop up, get the values from buttons and inputs, and close and open the main window again to get the inputs from that window. So, swapping back and forth - I'm sure there is a built in way to do this.

    Currently I'm closing the main window, then opening a new window, then closing again. Ideas? Guide me!!!

    while True:
    
    	b, values = window.Read()  # read input values from GUI
            
            # if you click config button, close main window and open config window:
    	if b == "config": # main menu config button press
    		window.Close()
    		window = sg.Window('Test Anatomy - Configuration Panel').Layout(
    					[[sg.Column(layout2)]]).Finalize()
    
            # if you click button on new window, close it and reopen main window:
    	if b == "Connect Database":
    		sg.Popup("Settings Saved")
    		window.Close()
    		window = sg.Window("Test Anatomy - Main Menu", grab_anywhere=True, no_titlebar=False, auto_size_text=False, icon=MY_WINDOW_ICON).Layout(layout).Finalize()
    

    This works - But is there a cleaner way?

    opened by eagleEggs 79
  • auto completion text box

    auto completion text box

    Hi, I am currently using vanilla tkinter in my GUI and wanted to move to pysimplegui but it lacks a very important feature of autocomplete text box given a list of values, I use the following modified Entrybox in tkinter which works great. could you look into implementing this?

    class AutocompleteEntry(Entry): def init(self, lista, *args, **kwargs):

        Entry.__init__(self, *args, **kwargs)
        self.lista = lista
        self.var = self["textvariable"]
        if self.var == '':
            self.var = self["textvariable"] = StringVar()
    
        self.var.trace('w', self.changed)
        self.bind("<Return>", self.selection)
        self.bind("<Up>", self.up)
        self.bind("<Down>", self.down)
    
        self.lb_up = False
    
    def changed(self, name, index, mode):
        try:
            self.lb.destroy()
            self.lb_up = False
        except Exception:
            pass
    
        words = self.comparison()
        if len(words)<15:
            if not self.lb_up:
                self.lb = Listbox(master=self.master)
                self.lb.bind("<Double-Button-1>", self.selection)
                self.lb.bind("<Return>", self.selection)
                self.lb.place(x=self.winfo_x(), y=self.winfo_y() + self.winfo_height(),height = len(words)*18,width = self.winfo_width())
                self.lb_up = True
                self.configure()
    
            self.lb.delete(0, END)
            for w in words:
                self.lb.insert(END, w)
        else:
            try:
                if self.lb_up:
                    self.lb.destroy()
                    self.lb_up = False
            except Exception:
                pass
    
    def selection(self, event):
    
        if self.lb_up:
            self.var.set(self.lb.get(ACTIVE))
            self.lb.destroy()
            self.lb_up = False
            self.icursor(END)
    
    def up(self, event):
    
        if self.lb_up:
            if self.lb.curselection() == ():
                index = '0'
            else:
                index = self.lb.curselection()[0]
            if index != '0':
                self.lb.selection_clear(first=index)
                index = str(int(index) - 1)
                self.lb.selection_set(first=index)
                self.lb.activate(index)
    
    def down(self, event):
    
        if self.lb_up:
            if self.lb.curselection() == ():
                index = '0'
            else:
                index = self.lb.curselection()[0]
            if index != END:
                self.lb.selection_clear(first=index)
                index = str(int(index) + 1)
                self.lb.selection_set(first=index)
                self.lb.activate(index)
    
    def comparison(self):
        pattern = re.compile('.*' + self.var.get() + '.*')
        return [w for w in self.lista if re.match(pattern, w)]
    
    enhancement Done - Download from GitHub (see docs for how) 
    opened by Dima-Kal 78
  • Bug - Setting Button Size Corrupts other Buttons

    Bug - Setting Button Size Corrupts other Buttons

    Enhancement Type of Issue (Enhancement, Error, Bug, Question) Bug


    Operating System Mac OS 11.5.2

    PySimpleGUI Port (tkinter, Qt, Wx, Web) tkinter


    Versions

    Python version (sg.sys.version) 3.8.18

    PySimpleGUI Version (sg.__version__) 4.45.0

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi) tkinter 8.6.10


    Your Experience In Months or Years (optional)

    3 Years Python programming experience

    40 Years Programming experience overall

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) yes

    Anything else you think would be helpful? None


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [x] Searched main docs for your problem www.PySimpleGUI.org
    • [ ] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
    • [ ] If not tkinter - looked for Demo Programs for specific port
    • [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [x] Run your program outside of your debugger (from a command line)
    • [x] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [ ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    I have two windows. For the top-level window, I want to make the buttons line up nicely, so I specify a size. However, for the window that is opened in response to pressing a button on the top-level window, the button text values are all the same width so I let them have their natural size. However, this corrupts the size of the buttons on the second window. If I don't set the size on the top level, the buttons on the second window are fine. I wouldn't think setting the size of buttons on one window would have an effect on the buttons on another.

    In the example code, search for "works fine". If this line is included, then the buttons on the second window look great. But if that line is commented and the line with "not so good" is uncommented, then the buttons on the second window get line wrapped and look bad.

    I tried setting the option to autosize buttons after creating the top-level window but that had no effect.

    Code To Duplicate

    import PySimpleGUI as sg                        # import required packages
    
    top_list = ['first','second','third one is longer']
    next_list = ['top button has a long label 0123012301230123',  \
                 'middle one is long as well! 0123012301230123',  \
                 'bottom one is same length!! 0123012301230123']
    
    def select_one():
        layout = []
        layout.append([sg.Text("Next-Level Window!")])
        for index,next_but in enumerate(next_list):
            layout.append([sg.Button(key=index,
                                     button_text=next_but)])
        layout.append([sg.Button("Exit")])
    
        window_sub = sg.Window('Top',layout)   # start the window
    
        while True:
            event, values = window_sub.read()          # catch an event
            if event == sg.WIN_CLOSED:                 # goodbye
                break
            elif event == "Exit":
                break
            else:
                print('happy to be here')
    
        window_sub.close()
    
    def mk_top_level():
        layout = []
        layout.append([sg.Text("Top-Level Window!")])
        for index,top_but in enumerate(top_list):
            layout.append([sg.Button(key=index,
                                     button_text=top_but, \
    #                                 )])                 # <= works fine
                                     size=(31,1))])     # <= not so good!
        layout.append([sg.Button("Exit"),
                       sg.Button("Other",pad=((200,0),0))])
    
        window_main = sg.Window('Top',layout)   # start the window
        return(window_main)
    
    sg.set_options(font=('Courier',16))          # set fonts and colors
    sg.set_options(input_text_color='blue')
    sg.set_options(button_color=('blue','lightgray'))
    
    window_main = mk_top_level()                    # start the GUI!
    
    while True:
        event, values = window_main.read()          # catch an event
        if event == sg.WIN_CLOSED:                  # goodbye
            break
        elif event == "Exit":
            break
        elif event == "Other":
            # hide the window to avoid clutter and set the game variable
            print('not functional now')
        else:
            # hide the window to avoid clutter and set the game variable
            window_main.Hide()
    
            ans = select_one()
            window_main.UnHide()   # unhide so another game can be selected
            
    window_main.close()
    

    Screenshot, Sketch, or Drawing

    Second window with 'works fine' image

    Second window with 'not so good' image


    Watcha Makin?

    If you care to share something about your project, it would be awesome to hear what you're building.

    Bug Done - Download from GitHub (see docs for how) 
    opened by SteveMillman 68
  • Question] Pysimplegui queries

    Question] Pysimplegui queries

    Type of Issues (Question)

    Operating System: Windows

    Python version: 3.8

    PySimpleGUI Port and Version ?

    Ports = tkinter, Qt, WxPython, Web ?

    PySimpleGUI Version: I haven’t started yet, still researching

    Your Experience Levels In Months or Years

    _3 years Python programming experience _____High school level Programming experience overall ___No Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?

    Description of Question:

    Hi

    I am making a quiz game for my project. The quiz game will have a log in and sign up page. I chose pysimplegui because I was having difficulty with tkinter and my project is due very soon,

    Questions:

    1. Can I integrate pysimplegui with MySql? I would like to store the username and password inputs in a MySql database.
    2. Can I have multiple pages within the one window. I will have a page for login, signup, quiz game and leaderboard table.
    3. Could I make the entire quiz using pysimplegui. I would then sort the quiz results with a simple bubble sort and feed it back to the database. Thanks
    question 
    opened by Twumwaa 67
  • Columns within tabbed groups (Duplication) unless using multiple Window declarations (Now tab colors)

    Columns within tabbed groups (Duplication) unless using multiple Window declarations (Now tab colors)

    Is there a reason that in the tabbed example script there is only a 'form2' window defined?

    I have the desired result that I'm looking for here in this code, which produces multiple columns across tabbed groups. I'm wondering if this is the proper way to go about it though (rendering two windows).

    In your tabbed example you only define a single form window (form2), a single Window which produces the right results for that script. However if I try the same when adding columns like this, then both layouts show up on tab2 (duplicated), and tab1 has a large blank space at the top of the tab.

    import PySimpleGUI as sg

    sg.ChangeLookAndFeel('Black')

    form = sg.Window('EBay Super Searcher', auto_size_text=False) form2 = sg.Window('EBay Super Searcher', auto_size_text=False)

    column1 = [[sg.Text('Column 1', background_color=sg.DEFAULT_BACKGROUND_COLOR, justification='center', size=(10, 10))]] column2 = [[sg.Text('Column 2', background_color=sg.DEFAULT_BACKGROUND_COLOR, justification='center', size=(10, 10))]]

    layout1 = [[sg.Column(column1, background_color='gray34'), sg.Column(column1, background_color='gray34')]]

    layout2 = [[sg.Column(column2, background_color='gray34'), sg.Column(column2, background_color='gray34')]]

    sg.ShowTabbedForm('eBay Super Searcher', (form, layout1,'Where To Save'), (form2, layout2, 'Categories & Search String'))

    ####################### ###Example of duplication:### #######################

    The original tabbed script also duplicates the tab's display when adding columns like this

    import PySimpleGUI as sg

    sg.ChangeLookAndFeel('Black')

    #window=sg.Window('EBay Super Searcher', auto_size_text=True) #form = sg.Window('EBay Super Searcher', auto_size_text=False) form2 = sg.Window('EBay Super Searcher', auto_size_text=False)

    column1 = [[sg.Text('Column 1', background_color=sg.DEFAULT_BACKGROUND_COLOR, justification='center', size=(10, 10))]] column2 = [[sg.Text('Column 2', background_color=sg.DEFAULT_BACKGROUND_COLOR, justification='center', size=(10, 10))]]

    layout1 = [[sg.Column(column1, background_color='gray34'), sg.Column(column1, background_color='gray34')]]

    layout2 = [[sg.Column(column2, background_color='gray34'), sg.Column(column2, background_color='gray34')]]

    sg.ShowTabbedForm('eBay Super Searcher', (form2, layout1,'Where To Save'), (form2, layout2, 'Categories & Search String'))

    opened by eagleEggs 64
  • [ Bug]  Tree missing col0_heading

    [ Bug] Tree missing col0_heading

    Bug

    Operating System

    Window10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    PySimpleGUI - tkinter

    Versions

    Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version (sg.sys.version)

    3.10.1

    PySimpleGUI Version (sg.__version__)

    4.55.1

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

    8.6.12


    Your Experience In Months or Years (optional)

    Years Python programming experience

    Years Programming experience overall

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)

    Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [X ] Searched main docs for your problem www.PySimpleGUI.org
    • [ X] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
    • [ X] If not tkinter - looked for Demo Programs for specific port
    • [ X] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [X] Run your program outside of your debugger (from a command line)
    • [ X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [ X] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    Where is the col0_heading for tree ?

    The docs shows that it has this option but there is nothing in the code. Tree(data = None, headings = None, visible_column_map = None, col_widths = None, col0_width = 10, col0_heading = "", def_col_width = 10, auto_size_columns = True, max_col_width = 20, select_mode = None, show_expanded = False, change_submits = False, enable_events = False, font = None, justification = "right", text_color = None, background_color = None, selected_row_colors = (None, None), header_text_color = None, header_background_color = None, header_font = None, num_rows = None, row_height = None, pad = None, p = None, key = None, k = None, tooltip = None, right_click_menu = None, expand_x = False, expand_y = False, visible = True, metadata = None)

    from the PySimpleGUI.py file:

      class Tree(Element):
        """
        Tree Element - Presents data in a tree-like manner, much like a file/folder browser.  Uses the TreeData class
        to hold the user's data and pass to the element for display.
        """
    
        def __init__(self, data=None, headings=None, visible_column_map=None, col_widths=None, col0_width=10,
                     def_col_width=10, auto_size_columns=True, max_col_width=20, select_mode=None, show_expanded=False,
                     change_submits=False, enable_events=False, font=None, justification='right', text_color=None,
                     background_color=None, selected_row_colors=(None, None), header_text_color=None, header_background_color=None,  header_font=None, num_rows=None,row_height=None, pad=None, p=None, key=None, k=None, tooltip=None,
                     right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None):
    

    Code To Duplicate

    A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

    This pre-formatted code block is all set for you to paste in your bit of code:

    
    # Paste your code here
    
    
    

    Screenshot, Sketch, or Drawing


    Watcha Makin?

    If you care to share something about your project, it would be awesome to hear what you're building.

    question TK 
    opened by robochopbg 62
  • [Bug]  Font used in Listbox of sg.Combo changed after another sg.Combo set with different font

    [Bug] Font used in Listbox of sg.Combo changed after another sg.Combo set with different font

    Type of Issue (Enhancement, Error, Bug, Question)

    Bug


    Operating System

    Windows 10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version (sg.sys.version)

    3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)]

    PySimpleGUI Version (sg.__version__)

    4.45.0

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

    8.6.9


    Your Experience In Months or Years (optional)

    Years Python programming experience 1 Years Programming experience overall 4 Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) no Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [X] Searched main docs for your problem www.PySimpleGUI.org
    • [X] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
    • [X] If not tkinter - looked for Demo Programs for specific port
    • [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [X] Run your program outside of your debugger (from a command line)
    • [X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [ ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    Have this problem that when i have a function that calls another window and if this window has a combo select, it changes the main window combo select text size. So main window has a combo dropdown with text size set to 14. Other window has a combo dropdown with text size 12. If i open this window before selecting the main window combo it auto changes the text size.

    Code To Duplicate

    A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

    This pre-formatted code block is all set for you to paste in your bit of code:

    
    # Paste your code here
    [sg.Combo((casino_name),key='brand_name',size=(19,16),font='Calibri 14',default_value='Select One',enable_events=True, readonly=True,pad=((4,22),(0,0)))
    
    [[sg.Combo((casino_name),key='-brand_name-',size=(19,16),font='Calibri 12',default_value='Select One',enable_events=True,readonly=True,pad=((0,0),(0,0)))]]
    
    

    Screenshot, Sketch, or Drawing


    main

    2ndwindow

    Watcha Makin?

    If you care to share something about your project, it would be awesome to hear what you're building.

    Bug TK 
    opened by robochopbg 62
  • [ Question] My problem is infinit loop after non-responsive window

    [ Question] My problem is infinit loop after non-responsive window

    Type of Issues (Question)

        Question
    

    Operating System

      Windows 10 Pro
    

    Python version

     3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:30:28) [MSC v.1926 32 bit (Intel)]
    

    PySimpleGUI Port and Version

    This is critical to know. Knowing where your PySimpleGUI.py file is located is just as important. You can get these by adding this to the top of your file and running it:

    <module 'PySimpleGUI' from 'C:\\Users\\Jgil\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages\\PySimpleGUI\\__init__.py'>
    4.26.0 Released 18-Jul-2020
    

    Your Experience Levels In Months or Years

    YES___ Python programming experience YES___ Programming experience overall _________ Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?

    You have completed these steps:

    • [YES ] Read instructions on how to file an Issue
    • [ YES] Searched through main docs http://www.PySimpleGUI.org for your problem
    • [ YES] Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [ YES] Looked for Demo Programs that are similar to your goal http://www.PySimpleGUI.com
    • [ YES] Note that there are also Demo Programs under each port on GitHub
    • [ YES] Run your program outside of your debugger (from a command line)
    • [ YES] Searched through Issues (open and closed) to see if already reported
    • [ YES] Try again by upgrading your PySimpleGUI.py file to use the current one on GitHub. Your problem may have already been fixed but is not yet on PyPI.

    Description of Problem / Question / Details

      After finishing a daemon to get IP connectivity result, new window_write_event is created and handled at the main loop. 
     However once popup message dissapear (as notification) the main loop enters in a infinite loop 
    

    Code To Duplicate

    A short program that isolates and demonstrates the problem (i.e. please don't paste a link to your 400 line program.... instead paste your 10 line program in full).

    Yes, it is a pain to narrow down problems, but it's part of the debugging process. Help me help you by providing something that can be executed so that work on getting you a fix or a workaround can immediately begin.

    This pre-formatted code block is all set for you to paste in your bit of code:

    import PySimpleGUI as sg
    print(sg)
    print(sg.version)
    
    ## 
    
    import PySimpleGUI as Sg  # For getting PySimpleGUI
    import platform  # For getting the operating system name
    import subprocess  # For executing a shell command
    import threading  # For threading and daemons
    import time  # For scheduler time
    import gc  # For garbage collector
    
    
    def ping_result_function(result, progressbar, window1):
        """
                Determine the current ping result from scheduler
                """
        if result is True:
    
            # status_result_update(window, 1)
            Sg.popup_notify('Connectivity Result', 'The device is reachable!', )
        else:
    
            # status_result_update(window, 2)
            Sg.popup('Connectivity Result', 'The device is unreachable!', button_type=4, auto_close=False, non_blocking=True,
                     line_width=30, no_titlebar=False, font='Lucida', background_color='Red', text_color='White',)
    
        window1[progressbar].update_bar(0)
    
    
    def ping(host):
        """
        Returns True if host (str) responds to a ping request.
        Remember that a host may not respond to a ping (ICMP) request even if the host name is valid.
        """
        # Option for the number of packets as a function of
        param = '-n' if platform.system().lower() == 'windows' else '-c'
        # Building the command. Ex: "ping -c 1 google.com"
        command = ['ping', param, '4', host]
        return subprocess.call(command) == 0
    
    
    def progress_bar(window1, option):
        """
            Update progress status bar. Other options are deleted
            """
        progressbar = '  '
        if option == 1:
            progressbar = 'Verification_Progressbar'
    
        for i in range(1000):
            window1[progressbar].update_bar(i + 1)
    
        return progressbar
    
    
    def ping_thread(ip, option, window1):
        time.sleep(5)
        result = ping(ip)
        result1 = progress_bar(window1, option)
        result2 = result, result1
        print(result2)
        window.write_event_value('-PING_RESULT-', result2)
        return
    
    
    def ping_long_function_thread(ip, option, window1):
        threading.Thread(target=ping_thread, args=(ip, option, window1), daemon=True).start()
    
    
    verify_button = [[Sg.Button(key='Check', border_width=0, size=(10, 1), disabled=False,)]]
    
    
    layout = [[Sg.Col([[Sg.Text('Enter the IP of the Device '), Sg.Input(key='-IP-V-', size=(20, 20)),
                       Sg.Checkbox('Connectivity Check', key='Connectivity_Check_v', enable_events=True)],
                      [Sg.ProgressBar(1000, orientation='h', size=(40, 30), key='Verification_Progressbar')], ],
                     key='-COL-VER-', visible=True)]]
    
    
    window = Sg.Window('Window Test', layout, size=(500, 410), margins=(3, 3), border_depth=1, alpha_channel=0.9)
    
    while True:
    
        events, values = window.read(timeout=100)
        print(events, values)
    
        # ############################ WINDOW CLOSED EVENT #############################
    
        if events in (Sg.WIN_CLOSED, 'Exit'):
            break
    
        # ##################  PING  HANDLING EVENT #########################
    
        if events == '-PING_RESULT-':
    
            if values['-PING_RESULT-'][0] is True:
    
                Sg.popup_notify('Connectivity Result', 'The device is reachable!', display_duration_in_ms=3000 )
            else:
    
                Sg.popup('Connectivity Result', 'The device is unreachable!', button_type=4, auto_close=False,
                         non_blocking=True,
                         line_width=30, no_titlebar=False, font='Lucida', background_color='Red', text_color='White', )
    
            window[values['-PING_RESULT-'][1]].update_bar(0)
    
        # ################## CONNECTIVITY HANDLING EVENT ###############################
    
        if events == 'Connectivity_Check_v':
            ping_long_function_thread(values['-IP-V-'], 1, window)
    
    
    var = window.close
    layout_main = None
    window = None
    gc.collect()
    
    
    
    opened by jgilcorrea 57
  • [PySimpleGUIWeb on Android] Instructions for running PySimpleGUI on Android

    [PySimpleGUIWeb on Android] Instructions for running PySimpleGUI on Android

    We've had a significant kinda breakthrough this week with one user, @MisterY cracking the code and getting PySimpleGUI up and running on Android. I am going to post his instructions next as the next post....

    opened by MikeTheWatchGuy 55
  • Need installer help

    Need installer help

    I followed the instructions on the PyPI site about packaging. I've done it before using PySimpleGUI.

    What I did was package up the chess demo and released it as PySimpleGUI-chess

    You can pip install it!

    It will install it in your site packages however. Do people know, somehow, to go to a path like this: C:\Python\Anaconda3\Lib\site-packages\PySimpleGUI-chess to get to their installed program?

    I got lucky and all of the image files as included. It ran successfully out of that folder. It's just weird that people will go to that location.

    I see these requirements.txt files in GitHub folders, but don't understand how they work. They don't seem to play any role in the process I just went through.

    help wanted Demo Programs 
    opened by MikeTheWatchGuy 52
  • [ Bug] Debug window does not open

    [ Bug] Debug window does not open

    Type of Issues (Enhancement, Error, Bug, Question) Bug

    Operating System Mac OS X.

    Python version 3.7

    PySimpleGUI Port and Version tk, 4.11.0

    Description I have added the debug button, but pressing it does nothing. I've attached 2 python files (as txt, rename to py). You should install Pyo. Start midi-env.py

    midi-env.txt pyoelements.txt

    Richard

    opened by zappfinger 49
  • [Enhancement] Multilanguage Support OneLineProgressMeter

    [Enhancement] Multilanguage Support OneLineProgressMeter

    Type of Issue (Enhancement, Error, Bug, Question)

    Enhancement

    Operating System

    All

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    4.60.3 Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version (sg.sys.version)

    10.7

    PySimpleGUI Version (sg.__version__)

    4.60.3

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)


    Your Experience In Months or Years (optional)

    Years Python programming experience 12

    Years Programming experience overall 40

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) yes

    Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [x] Searched main docs for your problem www.PySimpleGUI.org
    • [x] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
    • [ ] If not tkinter - looked for Demo Programs for specific port
    • [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [x] Run your program outside of your debugger (from a command line)
    • [x] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [x] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
    • [] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    I usually create multi language applications, where the complete GUI is translated (at runtime) into a selectable (or configurable ) language (eg German). I normally use gettext for the actual translations (for Python programs).

    OneLineProgressMeter includes several text strings (ie the statistics and the Cancel button) that can not be modified from the caller (or use gettext by itself).

    I know that I could implement my own OneLineProgressMeter (with my own QuickMeter and my own Cancel) by copying your code and slightly modifying it (ie wrap the translatable strings in _("text") or gettext.gettext("text")

    Would you accept a PR with these changes or have another idea?

    opened by rjungbeck 1
  • [Question]  - Any Possible way to upload a file?

    [Question] - Any Possible way to upload a file?

    Type of Issue (Question)


    Operating System Windows 10 64x

    PySimpleGUI Port (Web)


    Versions

    Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version 3.10.6

    PySimpleGUI Version 0.39.0

    GUI Version (Remi)


    Your Experience In Months or Years (optional)

    Years Python programming experience 2 Years

    Years Programming experience overall 3 Years

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) Yes i have used both

    Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [X ] Searched main docs for your problem www.PySimpleGUI.org
    • [X ] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
    • [ X] If not tkinter - looked for Demo Programs for specific port
    • [ X] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [X ] Run your program outside of your debugger (from a command line)
    • [ X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [ X] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
    • [X ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    Code To Duplicate

    A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

    This pre-formatted code block is all set for you to paste in your bit of code:

    
    # Paste your code here
    
    layout = [[sg.Text("1. Set Event.")],[sg.Combo(["DMO Practice/Demo Warning"," ", "TOR Tornado Warning"], enable_events=True, key='selalert')],[sg.Text("2. Set Duration, Date and Time.")],[sg.Combo(["0", "1", "2", "3", "4", "5", "6"], enable_events=True, key="hour")], [sg.Combo(["0", "15", "30", "45"], enable_events=True, key="minute")], [sg.Text("Set Location"), sg.InputText("", enable_events=True, key="fips")], [sg.Text("5. Set Audio")], [sg.Text("Select Optional Pre Alert Audio")]]
    window = sg.Window('DASDEC II CONTROL', layout, web_port=8888, web_start_browser=False)
    
    while True:
        event, values = window.read()
        print(event,values)
        print(event)
        print(values)
    
        if event in (None, 'QUIT'):
            break
    
        combo = values['selalert'] 
        alerttype = combo
    
    
    window.close()
    

    Watcha Makin?

    Web Control Panel for issuing emergency alerts.

    I Am wondering if its possible to upload a file to the server?

    If you care to share something about your project, it would be awesome to hear what you're building.

    question Web 
    opened by Ariemakesthebest 0
  • {Question]  NOTE - empty superfluous column header in Tree

    {Question] NOTE - empty superfluous column header in Tree

    Type of Issue (Enhancement, Error, Bug, Question)

    Bug


    Operating System

    Windows 10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version (sg.sys.version)

    *** Version information copied to your clipboard. Paste into your GitHub Issue. ***

    Python version: 3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)] port: tkinter

        PySimpleGUI filename: E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py
    

    PySimpleGUI Version (sg.__version__)

        PySimpleGUI version: 4.59.0
    

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

        tkinter version: 8.6.12
    

    Your Experience In Months or Years (optional)

    12

    Years Python programming experience 9

    Years Programming experience overall 18 Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) no Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [x] Searched main docs for your problem www.PySimpleGUI.org
    • [x] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
    • [x] If not tkinter - looked for Demo Programs for specific port
    • [x] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [x] Run your program outside of your debugger (from a command line)
    • [x] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [x] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
    • [x] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    The basic simple tree description in the documentation does not refer the requirement to fill the keyword parameter headers. If you don't pass headers explicitily you'll get this error:

    (base) S:\pysimplegui-essays>E:/Miniconda/python.exe s:/pysimplegui-essays/treedemo.py
    Traceback (most recent call last):
      File "s:\pysimplegui-essays\treedemo.py", line 4, in <module>
        sg.Window('title', [[sg.Tree(data=sg.TreeData(), key='-TREE-')]]).read()
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 9804, in read
        results = self._read(timeout=timeout, timeout_key=timeout_key)
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 9870, in _read
        self._Show()
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 9614, in _Show
        StartupTK(self)
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 16280, in StartupTK
        _convert_window_to_tk(window)
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 16167, in _convert_window_to_tk
        PackFormIntoFrame(window, master, window)
      File "E:\Miniconda\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 15868, in PackFormIntoFrame
        for i, heading in enumerate(element.ColumnHeadings):  # Configure cols + headings
    TypeError: 'NoneType' object is not iterable
    

    Code To Duplicate

    import PySimpleGUI as sg 
    sg.Window('title', [[sg.Tree(data=sg.TreeData(), key='-TREE-')]]).read()
    

    Screenshot, Sketch, or Drawing


    python_NiNp28aJXa

    This basic sample code gives the error pasted above. Unless you feel explicity headers=[], you still get the error. Besides, I don't understand, even if I using one single column, it appears a white bar above the column for the empty header. It is tkinter to blame for this or there is no other way ?

    question TK 
    opened by digfish 5
  • [ Question]  Examples / Support for plugin architecture

    [ Question] Examples / Support for plugin architecture

    Question

    Are there any ways to load or extend the built apps during runtime with plugins? I'm currently building out a local app that deals with ease-of-use features that don't need a CRM.

    It'd be pretty cool if I could use the same base app but distribute different plugins/modules so that teams can choose and use the modules they are interested in.

    From this question I believe that pyinstaller is capable of building app with external plugins but I am unable to find any concrete examples


    Operating System

    Linux and MacOS

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter

    Build system

    pyinstaller


    Versions

    Version information can be obtained by calling sg.main_get_debug_data() Or you can print each version shown in ()

    Python version (sg.sys.version)

    3.10.6 (main, Aug 3 2022, 17:39:45) [GCC 12.1.1 20220730]

    PySimpleGUI Version (sg.__version__)

    4.60.3

    GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

    8.6.12

    Watcha Makin?

    A tiny CRM interface + Tools

    question 
    opened by VaZark 2
  • [Question] Using Instance of a Class as target of a dialog Button cause

    [Question] Using Instance of a Class as target of a dialog Button cause "not subscriptable" exception

    Type of Issue (Enhancement, Error, Bug, Question)

    Question


    Operating System

    Microsoft WIndows 10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version: 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] port: tkinter tkinter version: 8.6.12 PySimpleGUI version: 4.60.3 PySimpleGUI filename: C:\Users\jgv\AppData\Local\Programs\Python\Python310\lib\site-packages\PySimpleGUI\PySimpleGUI.py


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [X] Searched main docs for your problem www.PySimpleGUI.org
    • [X] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
    • [ ] If not tkinter - looked for Demo Programs for specific port
    • [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [X] Run your program outside of your debugger (from a command line)
    • [X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [X] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
    • [ ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    Using class (instead of str,int,tuple) instance, for Element key, triggers ...

    Exception in Tkinter callback
    Traceback (most recent call last):
      File "C:\Users\jgv\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
        return self.func(*args)
      File "C:\Users\jgv\AppData\Local\Programs\Python\Python310\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 4770, in ButtonCallBack
        target_element, strvar, should_submit_window = self._find_target()
      File "C:\Users\jgv\AppData\Local\Programs\Python\Python310\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 4736, in _find_target
        if target[0] == ThisRow:
    TypeError: 'Key' object is not subscriptable
    

    Documentation states key may be an object but does not mention the object must be subscriptable.

    If I add a getitem method to the Key class, what should it return?

    Code To Duplicate

    
    from dataclasses import dataclass
    from PySimpleGUI import CalendarButton, Input, WIN_CLOSED, Window, main_get_debug_data
    
    print ( f'{main_get_debug_data()=}')
    
    @dataclass (frozen=True, slots=True, init=True, match_args=True, kw_only=False, repr=True, eq=True, order=False, unsafe_hash=False)
    class Key:
        ''' a PySimpleGUI.Element key '''
        text : str
        def __post_init__ (self) -> None:
            _text = str(self.text  ).replace('  ',' ').strip() if self.text is not None else ''
            if not _text : raise ValueError (f'{repr(self)} `text` must be defined')
            object.__setattr__ (self, 'text'  , _text  )
        def __str__ (self) -> str:
            return self.text
    
    key        = Key (f'date/time')
    key        = str (key) ### converting `key`  to `str` works -- disabling this line triggers the reported TypeError exception ###
    inputfield = Input          (default_text='', key=key)
    chooser    = CalendarButton ('choose date', target=key)
    layout     = [[inputfield, chooser]]
    window     = Window ('PySimpleGUI Key Class Demo', layout)
    event      = 'start' # anything but event=None since WIN_CLOSED==None
    while event != WIN_CLOSED:
        event, values = window.read()
    
    
    
    

    opened by jvickroy 4
  • Question - Windows scaling affecting application render

    Question - Windows scaling affecting application render

    Type of Issue (Enhancement, Error, Bug, Question)

    Question


    Operating System

    Windows 10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version: 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] port: tkinter tkinter version: 8.6.12 PySimpleGUI version: 4.60.3 PySimpleGUI filename: C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\PySimpleGUI\PySimpleGUI.py


    Your Experience In Months or Years (optional)

    Years Python programming experience

    6-8

    Years Programming experience overall

    10ish

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)

    No

    Anything else you think would be helpful?


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

    • [X] Searched main docs for your problem www.PySimpleGUI.org
    • [X] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
    • [ ] If not tkinter - looked for Demo Programs for specific port
    • [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
    • [ ] Run your program outside of your debugger (from a command line)
    • [X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
    • [ ] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
    • [ ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    The application was developed on a machine with the Window's scaling set to 100%. Another developer has their scaling set to 125% and it is causing render issues in part of the application. I can provide some code, but this seems like a more general problem. I've looked around but I was unable to find any solutions to the scaling.

    I've tried the below code as referenced in #80. But as far as I can tell, it will only set the scaling after the window is created and not before. I'm hoping we can adjust the pysimplegui window to always render at 100% but I don't know if Windows will allow that.

    Referring to the screenshot below, Windows is increasing the size of all the elements causing the Frame to be bigger than intended. I'm hoping to overwrite that setting.

    ~~If I cannot change the Windows scaling's effect, am I able to set a sg.Frame or sg.Column element to have a fixed width but height that only encapsulates the elements?~~ Fixed design, question no longer relevant.

    Code To Duplicate

    
    import PySimpleGUI as sg
    from src.lib.GlobalData import config
    
    
    input_data = [
        [
            sg.Text('Card Name', size=(10,1), justification='right'),
            sg.InputText(size=(4,1),expand_x=True,key='-name_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Types', size=(10,1), justification='right'),
            sg.Combo(values=config["supertypes"],default_value="",key='-supertype_card_data_form-', enable_events=True),
            sg.InputText(size=(4,1),expand_x=True,key='-subtype_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Class', size=(10,1), justification='right'),
            sg.Combo(values=config["classes"],default_value="",key='-class_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Cost', size=(10,1), justification='right'),
            sg.InputText(size=(4,1), justification='center', key='-cost_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Attack / Health',size=(10,1),justification='right'),
            sg.InputText(size=(4,1), justification='center', key='-will_card_data_form-', enable_events=True),
            sg.Text('/'),
            sg.InputText(size=(4,1), justification='center', key='-morale_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Top Text', size=(10,1), justification='right'),
            sg.Multiline(size=(5,3),expand_x=True,no_scrollbar=True,key='-toptext_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Bottom Text', size=(10,1), justification='right'),
            sg.Multiline(size=(5,3),expand_x=True,no_scrollbar=True,key='-bottomtext_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Flavor Text', size=(10,1), justification='right'),
            sg.Multiline(size=(5,2),expand_x=True,no_scrollbar=True,key='-flavor_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('Image', size=(10,1), justification='right'),
            sg.InputText(size=(5,1),expand_x=True,key='-img_card_data_form-', enable_events=True)
        ],
        [
            sg.Text('ObjectId', size=(10,1), justification='right'),
            sg.InputText(size=(5,1), expand_x=True, key='-_id_card_data_form-', readonly=True)
        ],
        [
            sg.Text('Last Updated', size=(10,1), justification='right'),
            sg.InputText(size=(5,1), expand_x=True, readonly=True, key='-last_updated_card_data_form-'),
            sg.Button(button_text='Changelog', key='-OPENCARDCHANGELOG-')
        ],
        [
            sg.Button('New Card', size=(10,1), key='-NEWCARD-', button_color=('white','blue')),
            sg.Push(),
            sg.Button(button_text='Save Render', key='-RENDER_SINGLE_CARD-'),
            sg.Button(button_text='Save Card Data', key='-SAVECARDDATA-'),
            sg.Button('Delete Card', key='-DELETECARD-',button_color=('white','red'))
        ]
    ]
    
    standalone_panel = [
        [sg.Column([[sg.Frame(title='',layout=[[]],size=(395,545),background_color="black",key='-SAMPLEIMAGE-')]], justification='left')],
        [sg.Frame(
            title='',
            layout=input_data,
            expand_x=True
            )
        ]
    ]
    
    layout = [
        # [sg.MenuBar(menu_layout)],
        [
            sg.Column(
                standalone_panel, 
                justification='center',
                ),
            # tab_group
        ]
    ]
    
    window = sg.Window(
        f'Card Management Tool', 
        layout, 
        finalize=True,
        resizable=True
    )
    # dpi = window.TKroot.winfo_fpixels('1i')
    # window.TKroot.tk.call('tk', 'scaling', 1) # Likely does not fix app size issue.
    window.TKroot.minsize(1920,1000)
    window.Maximize()
    
    while True:
        event, values = window.read(timeout=1000)
        if event == sg.WIN_CLOSED or event == 'Exit':
            break
    
    window.close()
    
    

    Screenshot, Sketch, or Drawing

    Windows Scaling

    image

    Scaling = 100%

    image

    Scaling = 125%

    image


    Watcha Makin?

    If you care to share something about your project, it would be awesome to hear what you're building.

    question TK 
    opened by ALaComb 8
Releases(4.60.3)
  • 4.60.3(Jul 27, 2022)

    4.60.3 PySimpleGUI 27-Jul-2022

    • Emergency Patch Release for Mac OS 12.3 and greater
      • Fixed bug in Mac OS version check in yesterday's 4.60.2 release
    Source code(tar.gz)
    Source code(zip)
  • 4.60.2(Jul 26, 2022)

    An emergency "dot release" to work around a problem that began with Mac OS 12.3.

    4.60.2 PySimpleGUI 26-Jul-2022

    • Emergency Patch Release for Mac OS 12.3 and greater
      • Adds a PySimpleGUI Mac Control Panel Controlled patch that sets the Alpha channel to 0.99 by default for these users
      • Is a workaround for a bug that was introduced into Mac OS 12.3
    Source code(tar.gz)
    Source code(zip)
  • 4.60.0(May 8, 2022)

    4.60.0 PySimpleGUI 8-May-2022

    TTK Scrollbars... the carpet now matches the drapes
    Debug Window improvements
    Built-in Screen-capture Initial Release
    Test Harness and Settings Windows fit on small screens better

    • Debug Window
      • Added the wait and blocking parameters (they are identical)
        • Setting to True will make the Print call wait for a user to press a Click To Continue... button
        • Example use - if you want to print right before exiting your program
      • Added Pause button
        • If clicked, the Print will not return until user presses Resume
        • Good for programs that are outputting information quickly and you want to pause execution so you can read the output
    • TTK
      • TTK Theme added to the PySimpleGUI Global Settings Window
      • Theme list is retrieved from tkinter now rather than hard coded
      • TTK Scrollbars
        • All Scrollbars have been replaced with TTK Scrollbars
        • Scrollbars now match the PySimpleGUI theme colors
        • Can indicate default settings in the PySimpleGUI Global Settings Window
        • Can preview the settings in the Global Settings Window
        • Scrollbars settings are defined in this priority order:
          • The Element's creation in your layout
          • The Window's creation
          • Calling set_options
          • The defaults in the PySimpleGUI Global Settings
        • The TTK Theme can change the appearance of scrollbars as well
        • Impacted Elements:
          • Multiline
          • Listbox
          • Table
          • Tree
          • Output
    • Tree Element gets horizontal scrollbar setting
    • sg.main() Test Harness
      • Restructured the main() Test Harness to be more compact. Now fits Pi screens better.
      • Made not modal so can interact with the Debug Window
      • Turned off Grab Anywhere (note you can always use Control+Drag to move any PySimpleGUI window)
      • Freed up graph lines as they scroll off the screen for better memory management
      • Made the upgrade from GitHub status window smaller to fit small screens better
    • Global Settings
      • Restructured the Global Settings window to be tabbed
      • Added ability to control Custom Titlebar. Set here and all of your applications will use this setting for the Titlebar and Menubar
      • TTK Theme can be specified in the global settings (already mentioned above)
      • New section for the Screenshot feature
    • Exception handling added to bind methods
    • Screenshots
      • First / early release of a built-in screenshot feature
      • Requires that PIL be installed on your system
      • New Window method save_window_screenshot_to_disk
      • Global Settings allows definition of a hotkey that triggers a save
      • Popup is shown when hotkeys are used
      • To be clear - PIL does not need to be installed in order to use PySimpleGUI. ONLY when a capture is attempted does PySimpleGUI try to import PIL
      • It's the first step of building the larger "Gallery" feature
      • The alignment is not perfect and the whole thing needs more work
      • The auto-numbering freature is not yet implemented. Only 1 file is used and is overwritten if exists
    • user_settings_delete_filename got a new parm report_error (off by default). The UserSettings object also got this parm to help control error reporting
    • Themes (PySimpleGUI Themes)
      • theme_global - added error checking and reporting should non-strandard theme names be attempted with this call
      • New theme Dark Grey 15. Give it a try!
      • New theme Python Plus - a more saturated blue and yellow colors. Give it a try!
      • New function - theme_button_color_background - read-only call that returns the button background color. Previously only available as a tuple using theme_button_color.
      • New function - theme_button_color_text - read-only call that returns the button text color. Previously only available as a tuple using theme_button_color.
      • New function - theme_use_custom_titlebar returns True if Global Settings indicate custom titlebars should will be used
    • Output Element - implementation changed to use the Multiline Element. No one should be impacted unless you were using some internal object details that was not published. I still suggest using the Multiline element instead so that you can access much more functionality.
    • Tab errors now use the popup errors with traceback
    • Column Element
      • Fixed scrollwheel not working correctly when expand paramters used. Scrolls the canvas now not the frame.
      • New size_subsample_width & size_subsample_height parameteres
        • Gives much more control over the sizing of SCROLLABLE columns. Previously the size was set to 1/2 the required height and the full required width.
        • The defaults are backward compatible (size_subsample_width=1, size_subsample_height=2)
        • Setting both to 1 will make the Column fit the contents exactly. One use is when you expect your Column to grow or shrink over time. Or maybe you didn't like the 1/2 size that PySimpleGUI has always used before.
    • Made Select Colors match the theme colors
      • Input, Multiline, Combo elements now use matching colors for selections of characters (big-time thanks to Jason who also provided the magic code to make the combo drop-down match the theme)
    • popup_get_file - Removed the file_types parameter use if on a Mac
      • Missed catching this problem when added the no_window option
      • Need to revisit this file types on the Mac topic in next release.
      • Particularly bad problem because cannot catch the exception. Your code simply crashes. And the behavior isn't the same across all Macs.
      • I'm really sorry Mac users that we keep running into these kinds of issues!
    • Auto-correct file_types problems for Browse buttons. Automatically change the formatting from (str, str) to ((str, str),) and warns the user
    • Docstring typo fixes for file_types parm
    Source code(tar.gz)
    Source code(zip)
  • 4.59.0(Apr 6, 2022)

    4.59.0 PySimpleGUI 5-Apr-2022

    An oh sh*t release due to yesterday's bug New force modal Windows option Test harness forces all windows to be modal and is no longer keep-on-top

    • Removed ttk theme from the test harness. Forgot that I had changed it for testing.
    • Fixed bug where disabled state was not correctly saved in update methods, causing events to not be generated (Thank you Jason, again!)
      • Changed numerous elements, not just the Input element that demonstrated the problem
    • New force_modal_windows parm added to set_options
      • Forces all windows to be modal
      • Overrides the disable_modal_windows option
      • Used in the main() test harness to ensure all windows are modal so no window is accidentally lost
    • Test Harness changes
      • Set keep_on_top=True for all popups and windows created by test harness
      • Set the main window keep_on_top=False. Ensures that all windows created by it should never be hidden. This is a somewhat experimental change. Let's hope for the best!
      • Forced all windows except for 1 non-modal popup to be modal. This also should ensure no windows are "lost" behind the main window
    Source code(tar.gz)
    Source code(zip)
  • 4.58.0(Apr 5, 2022)

    4.58.0 PySimpleGUI 3-Apr-2022

    A little of this and that release
    More focus on focus
    bind methods improved with propagate parm
    Visibility losing settings fix

    • execute_get_results Added checking for timeout error to instead of showing an error popup as it's not truly an error in this case
    • Checkbox Added cast to bool of default parm in case user passes in an incorrect type
    • ButtonMenu.update addition of button_text parameter. Enables changing text displayed on the ButtonMenu. Should have been an original feature.
    • Open GitHub Issue GUI Tabs use 2 lines now. Added tab asking where found PSG.
    • New symbols SYMBOL_CHECKMARK_SMALL & SYMBOL_X_SMALL
    • ButtonMenu.Click - Added click PEP8 alias ButtonMenu.click
    • Automatically add timeouts to user reads if a debugger window is opened. Debugger for multi-window applications still needs to be added
    • Window.start_thread a simple alias for Window.perform_long_operation. It's clearer what's happening with this alias.
    • bind_return_key parm added to Spin element. If element has focus and the return key is pressed, then an event is generated.
    • Event generation for disabled elements
      • If an element is disabled, then don't generate events (fixed specifically for Input element). However, if a Browse button fills in a disabled element, then an event should still be generated
      • Don't generate events if no files / folders selected using File or Folder Browse buttons. If cancel is clicked then no longer generates an event.
    • Fix docstring for image in the Titlebar element. Incorrectly said an ICO file can be used. Must be PNG or GIF
    • Windows-specific code that enables the PySimpleGUI supplied icon to be shown rather than the python.exe logo
    • Removed all temporary Tk() window creation calls
      • Instead create the hidden master root.
      • These were required for operations like getting the list of fonts from tkinter, the screensize, character width and height. This way one and only one Tk window will ever be creeated
      • The reason for the change is that the Mac crashes if multiple Tk() objects are created, even if only 1 at a time is active.
    • image_source parm added to Button
      • It can be either a filename or a base64 string.
      • This is like the Image elements parms
    • Graph element doc string improvement. Describes the mouse up event.
    • Improved support for focus
      • Element.get_next_focus added. Returns the element that should get the focus after the indicated element
      • Element.get_previous_focus added. Returns the element that should get the focus after the indicated element
      • Better exception error reporting for the Element focus methods. Uses popups with tracebacks now instead of prints
    • Window.widget_to_element returns the element that a tkinter widget is used to implement (it's a reverse lookup)
    • Element.widget added. It's a PEP8 compliant property that returns Element.Widget
    • Element.key added. It's a PEP8 compliant property that returns Element.Key
    • Simplified Radio, Checkbox, Slider creation. Moved the command parm outside the creation and instead made a config call.
    • Visibility fix
      • Expand and other settings were being lost when element is made invisible and visible again.
    • propagate parameter to the bind methods. Used to tell tkinter whether or not to propagate the event to the element / or window
    • Canvas.update method added so that a Canvas can be made visible/invisible
    • Removed the need for tk.scrolledtext.ScrolledText by adding a vertical scrollbar to a Text widget. Getting ready for addition of ttk scrollbars!
    • tooltip_offset parm added to set_options as a way to set tooltip location (a hack to get around an 8.6.12 bug)
    • Table and Tree elements new parameters
      • border_width - the border width for the element
      • header_border_width - the width of the border for the header
      • header_relief - the type of header relief to use
    • Table and Tree elements are now excluded from grab-anywhere so that headers can be resized without moving the window
    Source code(tar.gz)
    Source code(zip)
Owner
PySimpleGUI
Now Python programmers of all skill levels can make GUI programs. Commercial interests can contact: [email protected]
PySimpleGUI
Example GUI for Command line capable machine learning programs

Example GUI for Command line capable machine learning programs This is an example GUI made in PysimpleGUI and Tkinter, mainly for machine learning pro

Kim Yongwook 4 May 31, 2022
build GUIs from python functions, using magic.

magicgui: build GUIs from functions, using magic. ?? Docs Installation magicgui uses qtpy to support both pyside2 and pyqt5 backends. However, you mus

napari 216 Sep 20, 2022
Custom Widgets For PyQt5

pyqtCuWi Custom Widgets Icon Button Documentation Rank Widget Documentation PopUp OuterRadius PopUp Documentation OuterRadius Documentation Producer:

.CODE 0 Apr 4, 2022
Weather-API-GUI-Tkinter - A weather tool made using tkinter which works by fetching query city weather using an API

Weather-API-GUI-Tkinter ☁️ ❄️ version- 1️⃣ . 0️⃣ . 0️⃣ This repo contains a weat

SasiVatsal 4 Jul 8, 2022
guietta - a tool for making simple Python GUIs

guietta - a tool for making simple Python GUIs

Alfio Puglisi 1.9k Sep 30, 2022
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 23 Sep 23, 2022
Tkinter-ATM - Python GUI case made with Tkinter

tkinter-ATM Python GUI case made with Tkinter The task of this case was to creat

null 2 Jan 13, 2022
MATE Layouts is a small panel layout switching application for the MATE Desktop.

a small panel layout switching application for the MATE Desktop

Wilbur Wetterquarz 5 Jul 6, 2022
Create custom desktop notificatons using python

Create custom desktop notificatons using python In this video i am going to use a module called plyer

Niranjan 2 Dec 15, 2021
Py address book gui - An address book with graphical user interface developed with Python Tkinter

py_address_book_gui An address book with graphical user interface developed with

Milton 4 Feb 1, 2022
Advanced Zola Cabs integrated with tkinter Graphical User Interface (GUI) made for ZOHO Corp .

ZolaCabs Advanced Zola Cabs integrated with tkinter Graphical User Interface (GUI) made for ZOHO Corp. < Logs > username : zoho password : zoho [ Deve

Mastermind 9 Nov 18, 2021
Custom GUI for your Blender add-ons using Dear ImGui

Dear Imgui for Blender Use the infamous Dear ImGui library directly in your Blender scripts! This means custom GUI drawing in your operators: Normally

Elie Michel 77 Aug 25, 2022
Tkinter calculetor - Tkinter calculetor with python

Tkinter_calculetor required to run py file pip install tkinter

Yasir Arafat 0 Feb 7, 2022
Missing widgets and components for Qt-python

superqt! "missing" widgets and components for PyQt/PySide This repository aims to provide high-quality community-contributed Qt widgets and components

napari 69 Sep 26, 2022
Neukivy is a collection of neumorphic widgets built with Kivy.

Neukivy is a collection of neumorphic widgets built with Kivy. The library is currently in its initial development so there isn't much yet. But hopefully it will grow into a library you can use to easily create neumorphic UI in python.

Guhan Sensam 28 Aug 10, 2022
Browser - A GTK browser trying to follow the GNOME Human Interface Guidelines.

A simple GTK browser trying to follow the GNOME Human Interface Guidelines.

Cleo Menezes 11 May 8, 2022
Turn (almost) any Python command line program into a full GUI application with one line

Gooey Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line Support this project Table of Contents Gooey Table of conte

Chris 16.7k Sep 24, 2022
A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnaby's Brewhouse.

brewhouse-management A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnab

Isaac Cheng 2 Jul 9, 2022
Desktop application for Windows/macOS users to rotate through custom, preset, and searched-for collections of backgrounds with scheduling and additional settings

Background Revolution (In Development, Alpha Release) What? This will be an application for users to customize their windows backgrounds by uploading

Daniel Agapov 1 Nov 2, 2021