Border depth support, Refresh of demo programs,
This commit is contained in:
parent
623002b523
commit
05b1043758
4 changed files with 126 additions and 82 deletions
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
import PySimpleGUIQt as sg
|
||||
|
||||
sg.ChangeLookAndFeel('Topanga')
|
||||
sg.ChangeLookAndFeel('GreenTan')
|
||||
# sg.SetOptions(text_color='white')
|
||||
# ------ Column Definition ------ #
|
||||
column1 = [[sg.Text('Column 1', background_color='lightblue',text_color='black', justification='center', size=(100,22))],
|
||||
[sg.Spin((1,10), size=(100,22))],
|
||||
|
@ -9,18 +10,18 @@ column1 = [[sg.Text('Column 1', background_color='lightblue',text_color='black',
|
|||
[sg.Spin((1,10), size=(100,22))],]
|
||||
|
||||
layout = [
|
||||
[sg.Text('(Almost) All widgets in one Window!', justification='c', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)],
|
||||
[sg.Text('(Almost) All widgets in one Window!',click_submits=True, key='TEXT', justification='c', font=("Helvetica", 25), relief=sg.RELIEF_RAISED, tooltip='Text Element')],
|
||||
[sg.Text('Here is some text.... and a place to enter text')],
|
||||
[sg.InputText('This is my text', size=(400,22))],
|
||||
[sg.InputText('This is my text', size=(400,25))],
|
||||
[sg.Frame(layout=[
|
||||
[sg.Checkbox('Checkbox', size=(185,22)), sg.Checkbox('My second checkbox!', default=True)],
|
||||
[sg.Radio('My first Radio!', "RADIO1", default=True, size=(180,22), ),sg.Radio('My second Radio!', "RADIO1")],
|
||||
[sg.Radio('Third Radio!', "RADIO2", default=True, size=(180,22), ),
|
||||
sg.Radio('Fourth Radio!', "RADIO2")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN,
|
||||
tooltip='Use these to set flags', ), sg.Stretch()],
|
||||
[sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(220, 80)),
|
||||
[sg.Multiline(default_text='This is the default Text should you decide not to type anything',focus=True, size=(220, 80)),
|
||||
sg.Multiline(default_text='A second multi-line', size=(220, 80))],
|
||||
[sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(150, 22)), sg.Stretch(),
|
||||
[sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(150, 25)), sg.Stretch(),
|
||||
sg.Slider(range=(1, 100), orientation='h', size=(300, 22), default_value=85)],
|
||||
[sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],
|
||||
[sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(200,100), select_mode=sg.LISTBOX_SELECT_MODE_EXTENDED), sg.Stretch(),
|
||||
|
@ -28,7 +29,7 @@ layout = [
|
|||
sg.Slider(range=(1, 100), orientation='v', default_value=25, tick_interval=25),
|
||||
sg.Slider(range=(1, 100), orientation='v', default_value=75),
|
||||
sg.Slider(range=(1, 100), orientation='v', default_value=10),
|
||||
sg.Column(column1, background_color='lightblue')]], background_color='black'), sg.Stretch()],
|
||||
sg.Column(column1, background_color='lightblue')]], ), sg.Stretch(), sg.Dial((1,100))],
|
||||
[sg.Text('_' * 50, justification='c')],
|
||||
[sg.Text('Choose A Folder')],
|
||||
[sg.Text('Your Folder'),
|
||||
|
@ -43,7 +44,8 @@ window = sg.Window('Everything bagel',
|
|||
keep_on_top=False,
|
||||
element_padding=(2,3),
|
||||
default_element_size=(100, 23),
|
||||
default_button_element_size=(120,30)
|
||||
default_button_element_size=(120,30),
|
||||
# background_image='C:\Python\PycharmProjects\GooeyGUI\logo500black.png',
|
||||
).Layout(layout)
|
||||
event, values = window.Read()
|
||||
print(event, values)
|
||||
|
@ -52,6 +54,6 @@ window.Close()
|
|||
sg.Popup('Title',
|
||||
'The results of the window.',
|
||||
'The button clicked was "{}"'.format(event),
|
||||
'The values are', values)
|
||||
'The values are', values,)
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ def main():
|
|||
recording = True
|
||||
elif event == 'Stop':
|
||||
recording = False
|
||||
# img = np.full((480, 640),255)
|
||||
# imgbytes=cv2.imencode('.png', img)[1].tobytes() #this is faster, shorter and needs less includes
|
||||
# window.FindElement('image').Update(data=imgbytes)
|
||||
img = np.full((480, 640),255)
|
||||
imgbytes=cv2.imencode('.png', img)[1].tobytes() #this is faster, shorter and needs less includes
|
||||
window.FindElement('image').Update(data=imgbytes)
|
||||
elif event == 'About':
|
||||
sg.PopupNoWait('Made with PySimpleGUI',
|
||||
'www.PySimpleGUI.org',
|
||||
|
|
|
@ -3,6 +3,7 @@ from random import randint
|
|||
|
||||
def main():
|
||||
sg.ChangeLookAndFeel('GreenTan')
|
||||
# sg.SetOptions(element_padding=(0,0))
|
||||
# ------ Menu Definition ------ #
|
||||
menu_def = [['&File', ['&Open', '&Save', '&Properties', 'E&xit']],
|
||||
['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo'], ],
|
||||
|
@ -25,72 +26,86 @@ def main():
|
|||
|
||||
|
||||
frame1 = [
|
||||
[sg.Input('Input Text', size=(250,25)), sg.Stretch()],
|
||||
[sg.Multiline(size=(250,75),default_text='Multiline Input'),
|
||||
sg.MultilineOutput(size=(250,75),default_text='Multiline Output')],
|
||||
[sg.Input('Input Text', size=(250,35)), sg.Stretch()],
|
||||
[sg.Multiline(size=(250,75),default_text='Multiline Input'),
|
||||
sg.MultilineOutput(size=(250,75),default_text='Multiline Output')],
|
||||
]
|
||||
|
||||
frame2 = [
|
||||
[sg.Listbox(['Listbox 1','Listbox 2','Listbox 3'], size=(200,85))],
|
||||
[sg.Combo(['Combo item 1',], size=(200,35))],
|
||||
[sg.Spin([1,2,3], size=(40,30))],
|
||||
[sg.Listbox(['Listbox 1','Listbox 2','Listbox 3'], size=(200,85))],
|
||||
[sg.Combo(['Combo item 1','Combo item 2','Combo item 3'], size=(200,35))],
|
||||
[sg.Spin([1,2,3], size=(40,30))],
|
||||
]
|
||||
|
||||
frame3 = [
|
||||
[sg.Checkbox('Checkbox1', True),sg.Checkbox('Checkbox1')],
|
||||
[sg.Radio('Radio Button1', 1), sg.Radio('Radio Button2', 1, default=True)],
|
||||
[sg.Checkbox('Checkbox1', True),sg.Checkbox('Checkbox1')],
|
||||
[sg.Radio('Radio Button1', 1), sg.Radio('Radio Button2', 1, default=True), sg.Stretch()],
|
||||
]
|
||||
|
||||
frame4 = [
|
||||
[sg.Slider(range=(0,100), orientation='v', size=(3, 30), default_value=40), sg.Dial(range=(0,100),size=(200,200), default_value=40), sg.Stretch()],
|
||||
[sg.Slider(range=(0,100), orientation='v', size=(3, 30), default_value=40), sg.Dial(range=(0,100),tick_interval=50, size=(150,150), default_value=40), sg.Stretch()],
|
||||
]
|
||||
matrix = [[str(x*y) for x in range(4)] for y in range(3)]
|
||||
|
||||
frame5 = [
|
||||
[sg.Table(values=matrix, max_col_width=25,
|
||||
auto_size_columns=True, display_row_numbers=True, change_submits=False, bind_return_key=True, justification='right', num_rows=8, alternating_row_color='lightblue', key='_table_', text_color='black'),
|
||||
sg.Tree(data=treedata, headings=['col1', 'col2', 'col3'],change_submits=True, auto_size_columns=True, num_rows=10, col0_width=10, key='_TREE_', show_expanded=True, size=(300,150))],
|
||||
[sg.Table(values=matrix, max_col_width=25,
|
||||
auto_size_columns=True, display_row_numbers=True, change_submits=False, bind_return_key=True, justification='right', num_rows=8, alternating_row_color='lightblue', key='_table_', text_color='black'),
|
||||
sg.Tree(data=treedata, headings=['col1', 'col2', 'col3'],change_submits=True, auto_size_columns=True, num_rows=10, col0_width=10, key='_TREE_', show_expanded=True, size=(200,150)), sg.Stretch()],
|
||||
]
|
||||
|
||||
graph_elem = sg.Graph((800,150), (0,0), (800,300), key='+GRAPH+')
|
||||
graph_elem = sg.Graph((880,150), (0,0), (600,300), key='+GRAPH+')
|
||||
|
||||
frame6 = [
|
||||
[graph_elem],
|
||||
[graph_elem, sg.Stretch()],
|
||||
]
|
||||
|
||||
tab1 = sg.Tab('Graph Number 1',frame6)
|
||||
tab2 = sg.Tab('Graph Number 2',[[]])
|
||||
|
||||
layout = [
|
||||
[sg.Menu(menu_def)],
|
||||
[sg.Image(data_base64=logo),sg.Frame('Input Text Group', frame1, title_color='red'), sg.Stretch()],
|
||||
[sg.Frame('Multiple Choice Group', frame2, title_color='green'),
|
||||
sg.Frame('Binary Choice Group', frame3, title_color='purple'), sg.Frame('Variable Choice Group', frame4, title_color='blue'),sg.Stretch()],
|
||||
[sg.Frame('Structured Data Group', frame5, title_color='red'), ],
|
||||
# [sg.Frame('Graphing Group', frame6)],
|
||||
[sg.TabGroup([[tab1,tab2]])],
|
||||
[sg.ProgressBar(max_value=800, start_value=400, size=(600,25), key='+PROGRESS+'), sg.Stretch(), sg.Button('Button'), sg.Button('Exit')],
|
||||
[sg.Menu(menu_def)],
|
||||
[sg.Image(data_base64=logo),sg.Frame('Input Text Group', frame1, title_color='red'), sg.Stretch()],
|
||||
[sg.Frame('Multiple Choice Group', frame2, title_color='green'),
|
||||
sg.Frame('Binary Choice Group', frame3, title_color='purple'),
|
||||
sg.Frame('Variable Choice Group', frame4, title_color='blue'),sg.Stretch()],
|
||||
[sg.Frame('Structured Data Group', frame5, title_color='red'), ],
|
||||
# [sg.Frame('Graphing Group', frame6)],
|
||||
[sg.TabGroup([[tab1,tab2]])],
|
||||
[sg.ProgressBar(max_value=600, start_value=400, size=(600,25), key='+PROGRESS+'), sg.Stretch(),
|
||||
sg.ButtonMenu('&Menu', ['Menu', ['&Pause Graph', 'Menu item']], key='_MENU_'),
|
||||
sg.Button('Button'), sg.Button('Exit')],
|
||||
]
|
||||
|
||||
|
||||
window = sg.Window('Window Title',
|
||||
font=('Helvetica', 13)).Layout(layout).Finalize()
|
||||
font=('Helvetica', 13),
|
||||
default_button_element_size=(100,30),
|
||||
auto_size_buttons=False,
|
||||
default_element_size=(200,22)
|
||||
).Layout(layout).Finalize()
|
||||
graph_elem.DrawCircle((200,200), 50, 'blue')
|
||||
i=0
|
||||
graph_paused = False
|
||||
while True: # Event Loop
|
||||
# sg.TimerStart()
|
||||
event, values = window.Read(timeout=0)
|
||||
# print(event, values)
|
||||
if i < 800:
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
else:
|
||||
graph_elem.Move(-1,0)
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
|
||||
window.FindElement('+PROGRESS+').UpdateBar(i%800)
|
||||
if event is None or event == 'Exit':
|
||||
if event is None or event == 'Exit' :
|
||||
break
|
||||
i += 1
|
||||
if event == 'Button':
|
||||
print(event, values)
|
||||
if values['_MENU_'] == 'Pause Graph':
|
||||
graph_paused = not graph_paused
|
||||
if not graph_paused:
|
||||
i += 1
|
||||
|
||||
if i < 600:
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
else:
|
||||
graph_elem.Move(-1,0)
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
|
||||
window.FindElement('+PROGRESS+').UpdateBar(i%600)
|
||||
|
||||
# sg.TimerStop()
|
||||
window.Close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue