Merge pull request #356 from MikeTheWatchGuy/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2018-09-26 13:47:46 -04:00 committed by GitHub
commit 6ca582451c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 32 deletions

View File

@ -53,7 +53,7 @@ A simple GUI with default values. Results returned in a dictionary.
[sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')], [sg.Text('Name', size=(15, 1)), sg.InputText('name', key='name')],
[sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')], [sg.Text('Address', size=(15, 1)), sg.InputText('address', key='address')],
[sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')], [sg.Text('Phone', size=(15, 1)), sg.InputText('phone', key='phone')],
[sg.Submit(), sg.Cancel()] [sg.Submit(), sg.Cancel()]
] ]
window = sg.Window('Simple data entry GUI').Layout(layout) window = sg.Window('Simple data entry GUI').Layout(layout)
@ -316,29 +316,6 @@ This recipe shows just how easy it is to add a progress meter to your code.
sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'key') sg.OneLineProgressMeter('One Line Meter Example', i+1, 1000, 'key')
-----
## Tabbed Window
Tabbed Windows are **easy** to make and use in PySimpleGUI. You simple may your layouts for each tab and then instead of `LayoutAndRead` you call `ShowTabbedForm`. Results are returned as a list of form results. Each tab acts like a single window.
![tabbed form](https://user-images.githubusercontent.com/13696193/43956352-cffa6564-9c71-11e8-971b-2b395a668bf3.jpg)
import PySimpleGUI as sg
layout_tab_1 = [[sg.Text('First tab', size=(20, 1), font=('helvetica', 15))], [sg.InputText(), sg.Text('Enter some info')],
[sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]]
layout_tab_2 = [[sg.Text('Second Tab', size=(20, 1), font=('helvetica', 15))],
[sg.InputText(), sg.Text('Enter some info')],
[sg.Submit(button_color=('red', 'yellow')), sg.Cancel(button_color=('white', 'blue'))]]
window = sg.Window('')
form2 = sg.Window('')
results = sg.ShowTabbedForm('Tabbed form example', (form, layout_tab_1, 'First Tab'),
(form2, layout_tab_2, 'Second Tab'))
sg.Popup(results)
----- -----
## Button Graphics (Media Player) ## Button Graphics (Media Player)

View File

@ -5,7 +5,7 @@
![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png)
[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest)
![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg)
![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg)
@ -268,14 +268,18 @@ Some users have found that upgrading required using an extra flag on the pip `--
pip install --upgrade --no-cache-dir pip install --upgrade --no-cache-dir
On some versions of Linux you will need to first install pip. Need the Chicken before you can get the Egg (get it... Egg?)
`sudo apt install python3-pip `
If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it.
`tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to:
``` ```
ImportError: No module named tkinter ImportError: No module named tkinter
``` ```
then you need to install `tkinter`. Be sure and get the Python 3 version. then yosudou need to install `tkinter`. Be sure and get the Python 3 version.
`
```sudo apt-get install python3-tk ``` ```sudo apt-get install python3-tk ```
@ -285,12 +289,44 @@ then you need to install `tkinter`. Be sure and get the Python 3 version.
Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available
Like above, you may have to install either pip or tkinter. To do this on Python 2.7:
`sudo apt install python-pip`
`sudo apt install python-tkinter`
### Testing your installation
Once you have installed, or copied the .py file to your app folder, you can test the installation using python. At the command prompt start up Python.
#### Instructions for Python 2.7:
```
python
>>> import PySimpleGUI27
>>> PySimpleGUI27.main()
```
#### Instructions for Python 3:
```
python3
>>> import PySimpleGUI27
>>> PySimpleGUI27.main()
```
You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands
Here is the window you should see:
![sample window](https://user-images.githubusercontent.com/13696193/46097669-79efa500-c190-11e8-885c-e5d4d5d09ea6.jpg)
### Prerequisites ### Prerequisites
Python 2.7 or Python 3 Python 2.7 or Python 3
tkinter tkinter
PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`.
### EXE file creation ### EXE file creation
@ -316,6 +352,9 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi
Those using Python 2.7 will import a different module name Those using Python 2.7 will import a different module name
`import PySimpleGUI27 as sg` `import PySimpleGUI27 as sg`
## Code Samples Assume Python 3
While all of the code examples you will see in this Readme and the Cookbook assume Python 3 and thus have an `import PySimpleGUI` at the top, you can run ***all*** of this code on Python 2.7 by changing the import statement to `import PySimpleGUI27`
--- ---
## APIs ## APIs
@ -2478,6 +2517,16 @@ You can use Update to do things like:
* Change the choices in a list * Change the choices in a list
* etc * etc
### Updating Multiple Elements
If you have a large number of Elements to update, you can call `Window.UpdateElements()`.
` UpdateElements(key_list,
value_list)`
`key_list` - list of keys for elements you wish to update
`value_list` - list of values, one for each key
window.UpdateElements(('name', 'address', 'phone'), ('Fred Flintstone', '123 Rock Quarry Road', '555#'))
## Sample Applications ## Sample Applications
@ -2570,6 +2619,15 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch
Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar.
If you get a crash with something like:
```
ValueError: script '.......\src\tkinter' not found
```
Then try adding **`--hidden-import tkinter`** to your command
## Fun Stuff ## Fun Stuff
Here are some things to try if you're bored or want to further customize Here are some things to try if you're bored or want to further customize

View File

@ -5,7 +5,7 @@
![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png) ![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png)
[![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest) [![Downloads](http://pepy.tech/badge/pysimplegui)](http://pepy.tech/project/pysimplegui) ![Documentation Status](https://readthedocs.org/projects/pysimplegui/badge/?version=latest)
![Awesome Meter](https://img.shields.io/badge/Awesomeness_Rating-100%-yellow.svg) ![Awesome Meter](https://img.shields.io/badge/Awesome_meter-100-yellow.svg)
![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-2.7-yellow.svg)
@ -268,14 +268,18 @@ Some users have found that upgrading required using an extra flag on the pip `--
pip install --upgrade --no-cache-dir pip install --upgrade --no-cache-dir
On some versions of Linux you will need to first install pip. Need the Chicken before you can get the Egg (get it... Egg?)
`sudo apt install python3-pip `
If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it. If for some reason you are unable to install using `pip`, don't worry, you can still import PySimpleGUI by downloading the file PySimleGUI.py and placing it in your folder along with the application that is importing it.
`tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to: `tkinter` is a requirement for PySimpleGUI (the only requirement). Some OS variants, such as Ubuntu, do not some with `tkinter` already installed. If you get an error similar to:
``` ```
ImportError: No module named tkinter ImportError: No module named tkinter
``` ```
then you need to install `tkinter`. Be sure and get the Python 3 version. then yosudou need to install `tkinter`. Be sure and get the Python 3 version.
`
```sudo apt-get install python3-tk ``` ```sudo apt-get install python3-tk ```
@ -285,12 +289,44 @@ then you need to install `tkinter`. Be sure and get the Python 3 version.
Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available Python 2.7 support is relatively new and the bugs are still being worked out. I'm unsure what may need to be done to install tkinter for Python 2.7. Will update this readme when more info is available
Like above, you may have to install either pip or tkinter. To do this on Python 2.7:
`sudo apt install python-pip`
`sudo apt install python-tkinter`
### Testing your installation
Once you have installed, or copied the .py file to your app folder, you can test the installation using python. At the command prompt start up Python.
#### Instructions for Python 2.7:
```
python
>>> import PySimpleGUI27
>>> PySimpleGUI27.main()
```
#### Instructions for Python 3:
```
python3
>>> import PySimpleGUI27
>>> PySimpleGUI27.main()
```
You will see a sample window in the center of your screen. If it's not installed correctly you are likely to get an error message during one of those commands
Here is the window you should see:
![sample window](https://user-images.githubusercontent.com/13696193/46097669-79efa500-c190-11e8-885c-e5d4d5d09ea6.jpg)
### Prerequisites ### Prerequisites
Python 2.7 or Python 3 Python 2.7 or Python 3
tkinter tkinter
PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows. Runs on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`. PySimpleGUI Runs on all Python3 platforms that have tkinter running on them. It has been tested on Windows, Mac, Linux, Raspberry Pi. Even runs on `pypy3`.
### EXE file creation ### EXE file creation
@ -316,6 +352,9 @@ Yes, it's just that easy to have a window appear on the screen using Python. Wi
Those using Python 2.7 will import a different module name Those using Python 2.7 will import a different module name
`import PySimpleGUI27 as sg` `import PySimpleGUI27 as sg`
## Code Samples Assume Python 3
While all of the code examples you will see in this Readme and the Cookbook assume Python 3 and thus have an `import PySimpleGUI` at the top, you can run ***all*** of this code on Python 2.7 by changing the import statement to `import PySimpleGUI27`
--- ---
## APIs ## APIs
@ -2478,6 +2517,16 @@ You can use Update to do things like:
* Change the choices in a list * Change the choices in a list
* etc * etc
### Updating Multiple Elements
If you have a large number of Elements to update, you can call `Window.UpdateElements()`.
` UpdateElements(key_list,
value_list)`
`key_list` - list of keys for elements you wish to update
`value_list` - list of values, one for each key
window.UpdateElements(('name', 'address', 'phone'), ('Fred Flintstone', '123 Rock Quarry Road', '555#'))
## Sample Applications ## Sample Applications
@ -2570,6 +2619,15 @@ That's all... Run your `my_program.exe` file on the Windows machine of your ch
Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar.
If you get a crash with something like:
```
ValueError: script '.......\src\tkinter' not found
```
Then try adding **`--hidden-import tkinter`** to your command
## Fun Stuff ## Fun Stuff
Here are some things to try if you're bored or want to further customize Here are some things to try if you're bored or want to further customize