apply coupon for discount: |
## Recognition of Open Source Use In the Demo Programs or one of the PySimpleGUI Account's Repos these packages were used at least one time. Some of your are the goodies on the right of the GUI gap. If you use Open Source software in your project, be sure and supply information about the packages you used. - chatterbot - cv2 - fitz - forecastio - gtts - matplotlib - mido - mpl_toolkits - notifypy - numpy - pandas - PIL - praw - psgtray - psutil - pyfiglet - pygame - pylab - pymunk - requests - vlc - win32api - win32con - win32gui - win32process #### LPLG3 as an Example The licensing terms in the LLC3 Licensing, it states: > 4. Combined Works. > You may convey a Combined Work under terms of your choice that, > taken together, effectively do not restrict modification of the > portions of the Library contained in the Combined Work and reverse > engineering for debugging such modifications, if you also do each of > the following: > > a) Give prominent notice with each copy of the Combined Work that > the Library is used in it and that the Library and its use are > covered by this License. > > b) Accompany the Combined Work with a copy of the GNU GPL and this license > document. Since the above packages each have a similar license clause, I'm listing them here, in what I would consider a "prominent notice" location, that I'm using the fine works of these groups or individuals. They are used in the Demo Programs most likely or one of the Repos that are under this account as this list is all inclusive. You all have my respect and admiration. You're enabling bigger things. What a special kind of thing to make. Who knows what you've enabled. I believe more people are getting over to your creations and getting to experience them. tkinter team - PySimpleGUI would be nowhere without your lengthy work & continuous dedication. ONE GUI API for 3 different OS's? Really? With no code changes to move between? That's a huge accomplishment. You're #1 to me. Thank you for your hard work. ## Getting Over "The Bar" It's been said by some that "the bar is pretty high" when it comes to learning GUI programming in Python. > What happens when the bar is placed on the ground and can be stepped over? This is one of the questions that the PySimpleGUI project has tried to answer. Here's a humorous look at what's been a not funny situation.
The results have been fascinating to witness and it's been touching to read the accounts of the journeys of users. Nothing prepared me for the emails that started to arrive soon after the first release of PySimpleGUI. They are heartwarming and heartbreaking tales of life-long dreams of creating a program that required a GUI. Some made a few attempts, giving up each time. Others never started once they started to research what was required. After recounting the varied and long road to finding PySimpleGUI, the stories became similar. They each found success and expressed joy and gratitude. The joy expressed in these messages was unlike anything I had encountered in the entirety of career in the computing field. It's been these emails and the messages of gratitude seen here in the GitHub Issues that made dedicating my life to his project a non-decision.
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: ```python [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: ```python 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: ```python 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: ```python 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](http://calls.PySimpleGUI.org) 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.
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: ```python 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: ```python 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: ```python 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 | ![](https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/images/for_readme/ex1-tkinter.jpg) | | PySimpleGUIQt | ![](https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/images/for_readme/ex1-Qt.jpg) | | PySimpleGUIWx | ![](https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/images/for_readme/ex1-WxPython.jpg) | | PySimpleGUIWeb | ![](https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/images/for_readme/ex1-Remi.jpg) | 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 have 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) |