-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.py
36 lines (28 loc) · 790 Bytes
/
Test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import PySimpleGUI as sg
layout = [
[
sg.Graph(
canvas_size=(400, 400),
graph_bottom_left=(0, 400),
graph_top_right=(400, 0),
key="graph",
change_submits=True,
# enabling drag_submits enables mouse_drags, but disables mouse_up events
drag_submits=True
)
]
]
window = sg.Window("mouse events" , layout, size=(400,400))
window.Finalize()
graph = window.Element("graph")
click = False
while True:
event, values = window.Read()
if event is None:
break # exit
if event == "graph" and not click:
click = True
print("DOWN",values["graph"])
if event == "graph+UP" and click:
click = False
print("UP",values["graph"])