Merge pull request #3402 from PySimpleGUI/Dev-latest
Added a tuple example for button right click
This commit is contained in:
commit
10d6fb79d8
|
@ -14,22 +14,30 @@ import PySimpleGUI as sg
|
||||||
"""
|
"""
|
||||||
sg.theme('Dark Blue 3')
|
sg.theme('Dark Blue 3')
|
||||||
|
|
||||||
layout = [ [sg.Text('Move mouse over me', key='-TEXT-')],
|
def main():
|
||||||
|
layout = [ [sg.Text('Move mouse over me', key='-TEXT-')],
|
||||||
[sg.In(key='-IN-')],
|
[sg.In(key='-IN-')],
|
||||||
[sg.Button('Right Click Me', key='-BUTTON-'), sg.Button('Exit')] ]
|
[sg.Button('Right Click Me', key='-BUTTON-'), sg.Button('Right Click Me2', key=(2,3)),sg.Button('Exit'),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
window = sg.Window('Window Title', layout, finalize=True)
|
window = sg.Window('Window Title', layout, finalize=True)
|
||||||
|
|
||||||
window.bind('<FocusOut>', '+FOCUS OUT+')
|
window.bind('<FocusOut>', '+FOCUS OUT+')
|
||||||
|
|
||||||
window['-BUTTON-'].bind('<Button-3>', '+RIGHT CLICK+')
|
window['-BUTTON-'].bind('<Button-3>', '+RIGHT CLICK+')
|
||||||
window['-TEXT-'].bind('<Enter>', '+MOUSE OVER+')
|
window[(2,3)].bind('<Button-3>', '+RIGHT CLICK+')
|
||||||
window['-TEXT-'].bind('<Leave>', '+MOUSE AWAY+')
|
window['-TEXT-'].bind('<Enter>', '+MOUSE OVER+')
|
||||||
window['-IN-'].bind('<FocusIn>', '+INPUT FOCUS+')
|
window['-TEXT-'].bind('<Leave>', '+MOUSE AWAY+')
|
||||||
|
window['-IN-'].bind('<FocusIn>', '+INPUT FOCUS+')
|
||||||
|
|
||||||
while True: # Event Loop
|
while True: # Event Loop
|
||||||
event, values = window.read()
|
event, values = window.read()
|
||||||
print(event, values)
|
print(event, values)
|
||||||
if event in (sg.WIN_CLOSED, 'Exit'):
|
if event in (sg.WIN_CLOSED, 'Exit'):
|
||||||
break
|
break
|
||||||
window.close()
|
window.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue