Skip to content

Commit

Permalink
add: pattern2B
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdullahaml1 committed Feb 9, 2024
1 parent 8b24065 commit d398642
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pattern_1B_one_shot_window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PySimpleGUI as sg

event, values = sg.Window('Login Window',
[[sg.T('Enter your Login ID'), sg.In(key='-ID-')],
[sg.B('OK'), sg.B('Cancel') ]]).read(close=True)

login_id = values['-ID-']
17 changes: 17 additions & 0 deletions pattern_2B_persistent_window_loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import PySimpleGUI as sg

sg.theme('DarkAmber') # Keep things interesting for your users

layout = [[sg.Text('Persistent window')],
[sg.Input(key='-IN-')],
[sg.Button('Read'), sg.Exit()]]

window = sg.Window('Window that stays open', layout)

while True: # The Event Loop
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit':
break

window.close()

0 comments on commit d398642

Please sign in to comment.