Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,7 +1,4 @@
|
|||
import PySimpleGUI as sg
|
||||
# Import the elements individually to save space
|
||||
from PySimpleGUI import InputCombo, Combo, Multiline, ML, MLine, Checkbox, CB, Check, Button, B, Btn, ButtonMenu,BMenu, Canvas, Column, Col, Combo, DropDown, Drop, DD, Frame, Graph, Image, InputText, Input, In, I, Listbox, LBox, LB, Menu, Multiline, ML, MLine, OptionMenu, Output, Pane, ProgressBar, Prog, PBar, Radio, R, Rad, Sizer, Slider, Spin, StatusBar, Tab, TabGroup, Table, Text, Txt, T, Tree, TreeData, VerticalSeparator, Window, Print
|
||||
|
||||
|
||||
"""
|
||||
Demo - Compact Layouts and Element Renaming
|
||||
|
@ -10,7 +7,7 @@ from PySimpleGUI import InputCombo, Combo, Multiline, ML, MLine, Checkbox, CB, C
|
|||
programmers, there is little additional knowledge to be gained by writing
|
||||
sg.Text('My text')
|
||||
rather than using one of the shortcuts such as
|
||||
sg.T('My text')
|
||||
sg.Text('My text')
|
||||
However, even with shortcut usage, you continue to have the package prefix of
|
||||
sg.
|
||||
That's 3 characters per element that are added to your layout!
|
||||
|
@ -19,7 +16,7 @@ from PySimpleGUI import InputCombo, Combo, Multiline, ML, MLine, Checkbox, CB, C
|
|||
|
||||
If you don't want to use that very-long import or perhaps want to use your own shortcut names, you can easily
|
||||
create your shortcut by simple assignment:
|
||||
T = sg.Text
|
||||
T = sg.T
|
||||
This enables you to use T just as if you imported the Class T from PySimpleGUI. You could develop your own
|
||||
template that you copy and paste at the top of all of your PySimpleGUI programs. Or perhaps perform an import
|
||||
of those assignments from a .py file you create.
|
||||
|
@ -37,11 +34,14 @@ from PySimpleGUI import InputCombo, Combo, Multiline, ML, MLine, Checkbox, CB, C
|
|||
# A user created shortcut....
|
||||
# Suppose this user's layout contains many Multiline Elements. It could be advantageous to have a single letter
|
||||
# shortcut version for Multiline
|
||||
M = sg.Multiline
|
||||
M = sg.MLine
|
||||
B = sg.B
|
||||
|
||||
# This layout uses the user defined "M" element as well as the PySimpleGUI Button shortcut, B.
|
||||
layout = [[M(size=(30,3))],
|
||||
layout = [[M(size=(30, 3))],
|
||||
[B('OK')]]
|
||||
|
||||
event, values = Window('Shortcuts', layout).read()
|
||||
window = sg.Window('Shortcuts', layout).read()
|
||||
event, values = window.read()
|
||||
sg.popup_scrolled(event, values)
|
||||
window.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue