Removed last of Context Manager from Popups. Added Underscore to Menu Examples, Updated Templates, Better Popup examples
This commit is contained in:
parent
96635ef5a2
commit
d1773e6447
|
@ -8,9 +8,9 @@ else:
|
|||
sg.ChangeLookAndFeel('GreenTan')
|
||||
|
||||
# ------ Menu Definition ------ #
|
||||
menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']],
|
||||
['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ],
|
||||
['Help', 'About...'], ]
|
||||
menu_def = [['&File', ['&Open', '&Save', 'E&xit', 'Properties']],
|
||||
['&Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ],
|
||||
['&Help', '&About...'], ]
|
||||
|
||||
# ------ Column Definition ------ #
|
||||
column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
import PySimpleGUI as sg
|
||||
import PySimpleGUI_mod as sg
|
||||
else:
|
||||
import PySimpleGUI27 as sg
|
||||
"""
|
||||
|
@ -26,9 +26,10 @@ def TestMenus():
|
|||
sg.SetOptions(element_padding=(0, 0))
|
||||
|
||||
# ------ Menu Definition ------ #
|
||||
menu_def = [['File', ['O_&pen', 'Save', '---', 'Properties']],
|
||||
['Edit', ['Paste', ['Special', 'Normal',], 'Undo'],],
|
||||
['Help', 'About...'],]
|
||||
menu_def = [['&File', ['&Open', '&Save', '---', 'Properties', 'E&xit' ]],
|
||||
['&Edit', ['Paste', ['Special', 'Normal',], 'Undo'],],
|
||||
[''
|
||||
'&Help', '&About...'],]
|
||||
|
||||
# ------ GUI Defintion ------ #
|
||||
layout = [
|
||||
|
@ -48,9 +49,9 @@ def TestMenus():
|
|||
print('Button = ', button)
|
||||
# ------ Process menu choices ------ #
|
||||
if button == 'About...':
|
||||
window.Disable()
|
||||
sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...')
|
||||
window.Enable()
|
||||
window.Hide()
|
||||
sg.Popup('About this program','Version 1.0', 'PySimpleGUI rocks...', grab_anywhere=True)
|
||||
window.UnHide()
|
||||
elif button == 'Open':
|
||||
filename = sg.PopupGetFile('file to open', no_window=True)
|
||||
print(filename)
|
||||
|
|
|
@ -6,18 +6,23 @@ else:
|
|||
import PySimpleGUI27 as sg
|
||||
|
||||
# Here, have some windows on me....
|
||||
[sg.PopupNoWait(location=(10*x,0)) for x in range(10)]
|
||||
[sg.PopupNoWait(location=(500+100*x,500)) for x in range(10)]
|
||||
|
||||
print (sg.PopupYesNo('Yes No'))
|
||||
answer = sg.PopupYesNo('Do not worry about all those open windows... they will disappear at the end', 'Are you OK with that?')
|
||||
|
||||
print(sg.PopupGetText('Get text', location=(1000,200)))
|
||||
print(sg.PopupGetFile('Get file'))
|
||||
print(sg.PopupGetFolder('Get folder'))
|
||||
if answer == 'No':
|
||||
sg.PopupCancel('OK, we will destroy those windows as soon as you close this window')
|
||||
sys.exit()
|
||||
|
||||
sg.PopupNonBlocking('Your answer was',answer, location=(1000,600))
|
||||
|
||||
text = sg.PopupGetText('This is a call to PopopGetText', location=(1000,200))
|
||||
sg.PopupGetFile('Get file')
|
||||
sg.PopupGetFolder('Get folder')
|
||||
|
||||
|
||||
sg.Popup('Simple popup')
|
||||
|
||||
sg.PopupNonBlocking('Non Blocking', location=(500,500))
|
||||
sg.PopupNoTitlebar('No titlebar')
|
||||
sg.PopupNoBorder('No border')
|
||||
sg.PopupNoFrame('No frame')
|
||||
|
|
|
@ -10,7 +10,8 @@ if sys.version_info[0] >= 3:
|
|||
else:
|
||||
import PySimpleGUI27 as sg
|
||||
|
||||
layout = [[ sg.Text('My layout') ]]
|
||||
layout = [[ sg.Text('My layout') ],
|
||||
[ sg.Button('Next Window')]]
|
||||
|
||||
window = sg.Window('My window').Layout(layout)
|
||||
button, value = window.Read()
|
||||
|
@ -26,7 +27,8 @@ if sys.version_info[0] >= 3:
|
|||
else:
|
||||
import PySimpleGUI27 as sg
|
||||
|
||||
layout = [[ sg.Text('My layout') ]]
|
||||
layout = [[ sg.Text('My layout') ],
|
||||
[ sg.RButton('Read The Window')]]
|
||||
|
||||
window = sg.Window('My new window').Layout(layout)
|
||||
|
||||
|
@ -34,3 +36,4 @@ while True: # Event Loop
|
|||
button, value = window.Read()
|
||||
if button is None:
|
||||
break
|
||||
print(button, value)
|
|
@ -3873,7 +3873,7 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au
|
|||
if not args: return
|
||||
width, height = size
|
||||
width = width if width else MESSAGE_BOX_LINE_WIDTH
|
||||
with Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration) as form:
|
||||
form = Window(args[0], auto_size_text=True, button_color=button_color, auto_close=auto_close, auto_close_duration=auto_close_duration)
|
||||
max_line_total, max_line_width, total_lines, height_computed = 0,0,0,0
|
||||
complete_output = ''
|
||||
for message in args:
|
||||
|
@ -3899,7 +3899,7 @@ def ScrolledTextBox(*args, button_color=None, yes_no=False, auto_close=False, au
|
|||
button, values = form.Read()
|
||||
return button
|
||||
else:
|
||||
form.AddRow(Text('', size=(pad, 1), auto_size_text=False), SimpleButton('OK', size=(5, 1), button_color=button_color))
|
||||
form.AddRow(Text('', size=(pad, 1), auto_size_text=False), Button('OK', size=(5, 1), button_color=button_color))
|
||||
button, values = form.Read()
|
||||
return button
|
||||
|
||||
|
|
Loading…
Reference in New Issue