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

Issues
  • Screen shots (Not to be used by users... these are a scratchpad)

    Screen shots (Not to be used by users... these are a scratchpad)

    Learned this trick for hosting screen shots within GitHub msgbox gettextbox snap0102 snap0103 snap0104 snap0105

    https://app.leanboard.io/board/3efa539b-3c23-4ddb-98a6-b2cd4558565c

    opened by MikeTheWatchGuy 248
  • 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 
    opened by Dima-Kal 74
  • 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 
    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
  • [Request] Support for System Tray menu

    [Request] Support for System Tray menu

    Support for adding a menu to a system tray icon in windows.

    Something like this: image

    enhancement Done - Download from GitHub 
    opened by frakman1 63
  • [ 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
  • [ Bug]  NOTE - you can also call sg.main() or sg.main_open_github_issue() to post an issue

    [ Bug] NOTE - you can also call sg.main() or sg.main_open_github_issue() to post an issue

    Type of Issue

    Bug (and resolution) in example program (is out of step with matplotlib version 3.5.0)


    Operating System

    Ubuntu 18.04

    PySimpleGUI Port

    tkinter


    Versions

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

    Python version 3.6.9

    PySimpleGUI Version (sg.__version__)

    4.37.0 btw, it's sg.version, not sg.__version__ now

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

    8.6.8


    Your Experience In Months or Years (optional)

    Years Python programming experience 24 Years Programming experience overall 45 Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) yes Anything else you think would be helpful? All I want to do is offer the solution.


    Troubleshooting

    These items may solve your problem. Please check those you've done by changing - [ ] to - [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)
    • [ ] Run your program outside of your debugger (from a command line)
    • [ ] 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

    The example https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Matplotlib_Browser.py has (line 70, also line 74) ax0.hist(x, n_bins, normed=1, histtype='bar', color=colors, label=colors) normed - doesn't work density - does work FIX: replace normed by density in 2 places.

    Code To Duplicate

    just try and run the program, unchanged. The rest works, eg running from within IDLE. 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.

    opened by simonduane 2
  • Question - How can i set a Input border color and it would show WITHOUT it being focused

    Question - How can i set a Input border color and it would show WITHOUT it being focused

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

    Question


    Operating System

    Windows

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version: 3.9.8 (tags/v3.9.8:bb3fdcf, Nov 5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] port: tkinter tkinter version: 8.6.9 PySimpleGUI version: 4.55.1


    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

    I'm trying to have a red border for an Input and I need it to change dynamically... so I tried window['-IN-'].Widget.configure(highlightcolor='red4', highlightthickness=2) but it would only show the red when the Input is focused... So how can I set a border color even if I'm not focused? if possible I would like it to be with the element itself and not a frame but if there's no other way then I'd like you to show me how I can update the color of the frame and the border thickness

    Example of how the code should look:

    from PySimpleGUI import *
    layout = [
        [Input(default_text='test', key='IN')],
        [Button('RED', key='RED'), Button('GREEN', key='GREEN'), Button('RESET COLOR', key='RESET')]
    ]
    window = Window('test', layout)
    while True:
        event, values = window.read()
        if event == 'RED':
            window['IN'].border(color='red', width=1)
        elif event == 'GREEN':
            window['IN'].border(color='green', width=1)
        elif event == 'RESET':
            window['IN'].border(color='green', width=0)
    
    question 
    opened by KingOfTNT10 8
  • [Bug/Question]  First Window Finalize is Slower Than Subsequent

    [Bug/Question] First Window Finalize is Slower Than Subsequent

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

    Question / bug

    Operating System

    Windows

    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 ()

    Latest

    Python version (sg.sys.version)

    3.10

    PySimpleGUI Version (sg.__version__)

    Latest

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

    Latest tkinter


    Your Experience In Months or Years (optional)

    Years Python programming experience ~6

    Years Programming experience overall ~6

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

    Anything else you think would be helpful?

    No

    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

    The issue is that the first time the Gui needs to open, it is Slower to open that if I close and open it the second time. I think this has to do with tkinter being initialized the first time I create the window so I was wondering if it's possible to preload tkinter in a thread as soon as psg is imported in order to avoid the 1 second extra delay when the Gui needs to be opened for the first time?

    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:

    from functools import lru_cache
    import PySimpleGUI as sg
    import sys
    # https://raw.githubusercontent.com/elibroftw/music-caster/master/src/b64_images.py
    from b64_images import *
    from PIL import Image
    import io
    
    
    @lru_cache(maxsize=None)
    def resize_img(base64data, bg, new_size=(255, 255)) -> bytes:
        """ Resize and return b64 img data to new_size (w, h). (use .decode() on return statement for str) """
        img_data = io.BytesIO(b64decode(base64data))
        art_img: Image = Image.open(img_data)
        w, h = art_img.size
        if w == h:
            img = art_img.resize(new_size, Image.ANTIALIAS)
        else:
            ratio = h / w if w > h else w / h
            to_change = 1 if w > h else 0
            ratio_size = list(new_size)
            ratio_size[to_change] = round(new_size[to_change] * ratio)
            art_img = art_img.resize(ratio_size, Image.ANTIALIAS)
            paste_width = (new_size[0] - ratio_size[0]) // 2
            paste_height = (new_size[1] - ratio_size[1]) // 2
            img = Image.new('RGB', new_size, color=bg)
            img.paste(art_img, (paste_width, paste_height))
        data = io.BytesIO()
        img.save(data, format='png')
        return b64encode(data.getvalue())
    
    DEFAULT_ART = resize_img(DEFAULT_ART, 'black')
    WINDOW_ICON = resize_img(WINDOW_ICON, 'black')
    VOLUME_IMG = resize_img(VOLUME_IMG, 'black')
    NEXT_BUTTON_IMG = resize_img(NEXT_BUTTON_IMG, 'black')
    
    def make_window():
        return [
            [sg.Image(data=DEFAULT_ART)],
            [sg.Image(data=WINDOW_ICON)],
            [sg.Image(data=VOLUME_IMG)],
            [sg.Image(data=NEXT_BUTTON_IMG)]
            ]
    
    
    import time
    
    
    while True:
        print('Enter command: ', end='')
        user_input= input()
        if user_input == 'open':
            t1 = time.time()
            window = sg.Window('test', make_window(), finalize=True)
            print(time.time() - t1)
            event, values = window.read()
            window.close()
        elif user_input == 'close':
            sys.exit()
    
    
    

    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 
    opened by elibroftw 17
  • [Question] How to change the size of all elements ?

    [Question] How to change the size of all elements ?

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

    Question


    Operating System

    Win10-64

    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.7.6

    PySimpleGUI Version (sg.__version__)

    PSG Version = 4.53.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 2

    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
    • [ ] 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)
    • [ ] 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

    Not a bug - just want to know if this conclusion is correct :

    • can't change font size of most elements, such as frame, button, but can change of sg.T ... window['thing'].update() in reference of most calls doesn't list a font parameter and trying to change font gives TypeError, unexpected arg.

    My objective is to allow people to have, say, a laptop with 14" 1920x1080 screen and also a 20" gaming monitor of same resolution have "+" and "-" buttons for font size that would then update all the elements with an appropriate if for each button that increments/decrements. I found the font size selector example and can update text fine, just not other elements.

    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.

    opened by Steve-Swihart-BR 5
  • [Enhancement] Demo showing

    [Enhancement] Demo showing "Edit a cell"

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

    Enhancement


    Environment

    Operating System

    Windows version 10

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version (sg.sys.version)

    3.11.0a2 (tags/v3.11.0a2:e2b4e4b, Nov 5 2021, 20:00:05) [MSC v.1929 64 bit (AMD64)]

    PySimpleGUI Version (sg.__version__)

    4.55.1.4

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

    8.6.11


    Your Experience In Months or Years (optional)

    43 Years Python programming experience 4 Years Programming experience overall No Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) This project and the users!


    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
    • [ ] 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)
    • [ ] 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'm working on the Table lesson for the new course.

    It would be nice to be able to point to a demo that does an "edit" operation.

    In Qt it's possible to do that.

    Jason wrote the code that does the detect of click events for cells and headers. I'm hoping that maybe Jason can work his magic again and help make this example better. My focus really needs to be on the course more than working on this enhancement. I tend to add to elements as I record the lessons. This would be a fantastic one to have.

    So far I have a little input that pops up when you click a cell. The problem is that it pops up where the mouse clicked. It would be ideal if it popped up exactly where that cell is located so that it looks like the cell is being typed in.

    To use the example, click on a cell. When the input opens, type the new value. Press return to save it or Escape to cancel.

    It's pretty close, kind of, but could be a lot better.

    Code To Duplicate

    import PySimpleGUI as sg
    import random, string
    
    # ------ Some functions to help generate data for the table ------
    def word():
        return ''.join(random.choice(string.ascii_lowercase) for i in range(10))
    def number(max_val=1000):
        return random.randint(0, max_val)
    
    def make_table(num_rows, num_cols):
        data = [[j for j in range(num_cols)] for i in range(num_rows)]
        data[0] = [word() for _ in range(num_cols)]
        for i in range(0, num_rows):
            data[i] = [i, word(), *[number() for i in range(num_cols - 1)]]
        return data
    
    def main_example1():
        def edit_cell(location):
            layout = [[sg.In(s=5, k='-IN-')],
                      [sg.B('Ok', visible=False, bind_return_key=True)]]
    
            window = sg.Window('', layout, no_titlebar=True, location=location, margins=(0,0), element_padding=(0,0), return_keyboard_events=True, keep_on_top=True, modal=True)
            while True:
                event, values = window.read()
                print(event, values)
                if event == 'Ok':
                    window.close()
                    return values['-IN-']
                elif event.startswith('Escape'):
                    window.close()
                    return None
    
        # ------ Make the Table Data ------
        # sg.Print('Creating table...')
        data = make_table(num_rows=10_000, num_cols=6)
        # headings = [str(data[0][x])+'     ..' for x in range(len(data[0]))]
        headings = [f'Col {col}' for col in range(len(data[0]))]
        # sg.Print('Done creating table.  Creating GUI...')
        layout = [[sg.Table(values=data, headings=headings, max_col_width=25,
                            auto_size_columns=True,
                            # display_row_numbers=True,
                            justification='right',
                            num_rows=20,
                            alternating_row_color=sg.theme_button_color()[1],
                            key='-TABLE-',
                            # selected_row_colors='red on yellow',
                            # enable_events=True,
                            # select_mode=sg.TABLE_SELECT_MODE_BROWSE,
                            expand_x=True,
                            expand_y=True,
                            enable_click_events=True,  # Comment out to not enable header and other clicks
                            )],
                  [sg.Button('Read'), sg.Button('Double'), sg.Button('Change Colors')],
                  [sg.Text('Cell clicked:'), sg.T(k='-CLICKED-')]]
    
    
        window = sg.Window('Table Element - Example 1', layout, resizable=True)
    
        while True:
            event, values = window.read()
            if event in (sg.WIN_CLOSED, 'Exit'):
                break
            if isinstance(event, tuple):
                cell = event[2]
                window['-CLICKED-'].update(cell)
                new_value = edit_cell(location=window.mouse_location())
                if new_value is not None:
                    data[cell[0]][cell[1]] = new_value
                    window['-TABLE-'].update(data)
    
        window.close()
    
    main_example1()
    
    
    

    Screenshot, Sketch, or Drawing


    enhancement Demo Programs 
    opened by PySimpleGUI 12
  • Question pin() changes color of column

    Question pin() changes color of column

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

    Question


    Operating System

    Windows

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version: 3.9.8 (tags/v3.9.8:bb3fdcf, Nov 5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] port: tkinter tkinter version: 8.6.9 PySimpleGUI version: 4.55.1

    Python version (sg.sys.version)

    3.9.8

    PySimpleGUI Version (sg.__version__)

    4.55.1

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

    8.6.9


    Your Experience In Months or Years (optional)

    Years Python programming experience 1 year

    Years Programming experience overall 5 years

    Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) some tkinter and a bit of Qt

    Anything else you think would be helpful?


    Troubleshooting

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

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

    Detailed Description

    I need to pin my columns because I'm hiding and showing them and they are getting misaligned... but when I'm showing them (they are pinned) the highlight color gets changed

    Code To Duplicate

    
    column1 = [[Button("test")]]
    layout = [[pin(Column(column1, element_justification='c', background_color='#404040', visible=True))]]
    
    theme('Dark')
    window = Window("test", layout, background_color='#404040')
    while True:
        event, values = window.read()
    
    
    

    Screenshot, Sketch, or Drawing

    image


    Bug 
    opened by KingOfTNT10 2
  • [Question]

    [Question]"window.write_event_value" will block the thread when i want to stop the thread

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

    I found a question about "window.write_event_value", ,I use it in a thread, but when i want to stop the thread( set the thread's run flag to False,then the thread.join() is called, then it is bloced)


    Operating System

    window 10 64-bit

    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)

    Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

    PySimpleGUI Version (sg.__version__)

    pysimplegui 4.53.0 pypi_0 pypi

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

    8.6


    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]

    Detailed Description

         **#sg.popup("Stop the Thread")**
    

    is versy import , if it exists, the code works, but if it is commeted , the code will be blocked.

    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
    
    import threading
    import time
    import PySimpleGUI as sg
    
    """
        Threaded Demo - Uses Window.write_event_value to communicate from thread to GUI
        
        A demo specifically to show how to use write_event_value to
            "show a popup from a thread"
            
        You cannot make any direct calls into PySimpleGUI from a thread
        except for Window.write_event_value()
        Cuation - This method still has a risk of tkinter crashing
        
        Copyright 2021 PySimpleGUI
    """
    
    thread_alive_flag = True
    def the_thread(window:sg.Window, seconds):
        global thread_alive_flag
        """
        The thread that communicates with the application through the window's events.
    
        Wakes every X seconds that are provided by user in the main GUI:
            Sends an event to the main thread
            Goes back to sleep
        """
        i = 0
        while thread_alive_flag:
            time.sleep(0.5)
            # send a message to the main GUI. It will be read using window.read()
            # the "Value" send is a tuple that contains all the things to show in the popup
            window.write_event_value('-POPUP-',
                                     ('Hello this is the thread...',
                                      f'My counter is {i}',
                                      f'Will send another message in {seconds} seconds'))
            i += 1
    
    
    def main():
        global thread_alive_flag
        """
        Every time "Start A Thread" is clicked a new thread is started
        When the event is received from the thread, a popup is shown in its behalf
        """
    
        layout = [  [sg.Output(size=(60,10))],
                    [sg.T('How often a thread will show a popup in seconds'),
                     sg.Spin((2, 5, 10, 20), initial_value=5, k='-SPIN-')],
                    [sg.B('Start A Thread'), sg.B('Dummy'), sg.Button('Exit')]  ]
    
        window = sg.Window('Window Title', layout, finalize=True, font='_ 15')
    
        t1 = None
        while True:             # Event Loop
            event, values = window.read()
            print(event, values)
            if event == sg.WIN_CLOSED:
                break
            elif event == 'Exit':
               
            
                #stop the thread
                thread_alive_flag = False
                **#sg.popup("Stop the Thread")**
                
                t1.join()
                t1 = None
                
               
            elif event == '-POPUP-':
                #sg.popup_non_blocking('This is a popup that the thread wants to show',
                         #*values['-POPUP-'])
                print("Thread is running")
            elif event == 'Start A Thread':
                print(f'Starting thread.  You will see a new popup every {values["-SPIN-"]} seconds')
                thread_alive_flag = True
                t1 = threading.Thread(target=the_thread, args=(window, values['-SPIN-']), daemon=True)
                t1.start()
        window.close()
    
    
    if __name__ == '__main__':
        main()
    

    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.

    opened by andrepan 2
  • [Bug/Question]  double registration of events with timeout specified.

    [Bug/Question] double registration of events with timeout specified.

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

    Question/Bug

    Operating System

    Linux / Ubuntu/ Rpi

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    web

    Versions

    0.39.0 , remi 2021.3.2

    Python version (sg.sys.version)

    3.8

    PySimpleGUI Version (sg.__version__)

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

    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
    • [ ] 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)
    • [ ] 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

    Any button click/checkbox click if registered twice when using .read(timeout=x)

    Code To Duplicate

    The main program depends on GPIO and named pipes to other processes to run So here is a simple illustration:

    sg.Checkbox('On/Off', size=(10, 1), enable_events=True, key='_EXT_GHT_ON_'),
    while True:
       event, values = window.Read(timeout=50)  #
    
        if event in (None, '_EXT_GHT_ON_'):
            light_off = values['_EXT_GHT_ON_']
            time.sleep(0.2)
            print("I am here")
    
    

    I do not wish to halt the main loop, so I use the "timeout=50" to let it run without events. In short: With "timeout=50" - I get two "I am here" when toggling the checkbox, plus, the checkbox visually goes off/on/off/on (toggle once more than needed)

    Without "timout=50" - the main loop is not working, but each checkbox toggle prints "I am here" only once.

    Bug Web 
    opened by AndKe 3
  • [ Enhancement]  Style replace ttkbootstrap

    [ Enhancement] Style replace ttkbootstrap

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


    Operating System

    PySimpleGUI Port (tkinter, Qt, Wx, Web)


    Versions

    Python version (sg.sys.version)

    PySimpleGUI Version (sg.__version__)

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


    Your Experience In Months or Years (optional)


    Troubleshooting

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

    Detailed Description

    ttkbootstrap

    
    PySimpleGUI Style  How to replace style
    
    ttkbootstrap
    https://github.com/israel-dryer/ttkbootstrap
    
    I like ttkbootstrap style
    
    
    
    

    Code To Duplicate

    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.

    opened by monkeycc 6
  • [ Enhancement]  Column Justification for sg.Pin() Helper Function

    [ Enhancement] Column Justification for sg.Pin() Helper Function

    Type of Issue (Enhancement)

    Would be great to accept a justifciation parameter to this helper function so align the pinned column. I have implemented this myself with my own helper function but figure it would be an easy addition and potentially help other people.


    Operating System

    Windows

    PySimpleGUI Port (tkinter, Qt, Wx, Web)

    tkinter


    Versions

    Python version: 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] port: tkinter tkinter version: 8.6.10 PySimpleGUI version: 4.51.7


    Your Experience In Months or Years (optional)

    Years Python programming experience -10

    Years Programming experience overall - 12

    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 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] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

    Detailed Description

    Check the code down below for the current and my implementation

    Code To Duplicate

    Current Helper Function

    
    def pin(elem, vertical_alignment=None, shrink=True, expand_x=None, expand_y=None):
        """
        Pin's an element provided into a layout so that when it's made invisible and visible again, it will
         be in the correct place.  Otherwise it will be placed at the end of its containing window/column.
    
        :param elem:               the element to put into the layout
        :type elem:                Element
        :param vertical_alignment: Aligns elements vertically. 'top', 'center', 'bottom'. Can be shortened to 't', 'c', 'b'
        :type vertical_alignment:  str | None
        :param shrink:             If True, then the space will shrink down to a single pixel when hidden. False leaves the area large and blank
        :type shrink:              bool
        :param expand_x:           If True/False the value will be passed to the Column Elements used to make this feature
        :type expand_x:            (bool)
        :param expand_y:           If True/False the value will be passed to the Column Elements used to make this feature
        :type expand_y:            (bool)
        :return:                   A column element containing the provided element
        :rtype:                    Column
        """
        if shrink:
            # return Column([[elem, Canvas(size=(0, 0),background_color=elem.BackgroundColor, pad=(0, 0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
            return Column([[elem, Column([[]],pad=(0,0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
        else:
            return Column([[elem]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
    
    
    

    Suggested Update

    
    def pin(elem, vertical_alignment=None, shrink=True, expand_x=None, expand_y=None, justification=None):
        """
        Pin's an element provided into a layout so that when it's made invisible and visible again, it will
         be in the correct place.  Otherwise it will be placed at the end of its containing window/column.
    
        :param elem:               the element to put into the layout
        :type elem:                Element
        :param vertical_alignment: Aligns elements vertically. 'top', 'center', 'bottom'. Can be shortened to 't', 'c', 'b'
        :type vertical_alignment:  str | None
        :param shrink:             If True, then the space will shrink down to a single pixel when hidden. False leaves the area large and blank
        :type shrink:              bool
        :param expand_x:           If True/False the value will be passed to the Column Elements used to make this feature
        :type expand_x:            (bool)
        :param expand_y:           If True/False the value will be passed to the Column Elements used to make this feature
        :type expand_y:            (bool)
        :return:                   A column element containing the provided element
        :rtype:                    Column
        """
        if shrink:
            # return Column([[elem, Canvas(size=(0, 0),background_color=elem.BackgroundColor, pad=(0, 0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y)
            return Column([[elem, Column([[]],pad=(0,0))]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y, justification=justification)
        else:
            return Column([[elem]], pad=(0, 0), vertical_alignment=vertical_alignment, expand_x=expand_x, expand_y=expand_y, justification=justification)
    
    
    

    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.

    enhancement 
    opened by specky532 1
Owner
PySimpleGUI
Now Python programmers of all skill levels can make GUI programs. Commercial interests can contact: [email protected]
PySimpleGUI
Custom Widgets For PyQt5

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

.CODE 0 Aug 30, 2021
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
guietta - a tool for making simple Python GUIs

guietta - a tool for making simple Python GUIs

Alfio Puglisi 1.9k Nov 26, 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 58 Nov 12, 2021
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 9 Dec 1, 2021
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 2 Oct 9, 2021
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 15.1k Dec 2, 2021
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 12 Sep 9, 2021
Signin/Signup GUI form using tkinter in python

SignIn-SignUpFormRepo Hello there, I am Shahid and this is the Signin/Signup GUI form using tkinter in python if you want to use avatar images then pa

Shahid Akhtar 1 Nov 9, 2021
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 23 Nov 14, 2021
Learn to build a Python Desktop GUI app using pywebview, Python, JavaScript, HTML, & CSS.

Python Desktop App Learn how to make a desktop GUI application using Python, JavaScript, HTML, & CSS all thanks to pywebview. pywebview is essentially

Coding For Entrepreneurs 34 Oct 8, 2021
Basic calculator using Tkinter GUI

Basic calculator using Tkinter GUI

Rogerio Penchel 19 Oct 15, 2021
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
My Git GUI version made in Python and Tkinter.

Description My Git GUI version made in Python and Tkinter. How to use Basically, create a folder in your computer, open the software, select the path

Matheus Golzio 4 Oct 10, 2021
Simple GUI python app to show a stocks graph performance. Made with Matplotlib and Tiingo.

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

Toby 8 Nov 25, 2021
A simple desktop news application written using python created using PyQt5

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

Sritiman Adak 1 Nov 14, 2021
Advanced GUI Calculator with Beautiful UI and Clear Code.

Advanced GUI Calculator with Beautiful UI and Clear Code.

Mohammad Dori 2 Dec 2, 2021
An offline python frontend for the QuadVisions Colab Notebook using tkinter.

Visions GUI An offline python frontend for the QuadVisions Colab Notebook using tkinter. It offers basic options and interactively displays the genera

null 6 Nov 14, 2021
This repository contains some projects that I have done using Python + Tkinter.

This repository contains some projects that I have done using Python + Tkinter.

João Victor Vilela dos Santos 1 Nov 10, 2021