ยปCore Development>Code coverage>Lib/lib-tk/test/test_ttk/support.py

Python code coverage for Lib/lib-tk/test/test_ttk/support.py

#countcontent
1n/aimport Tkinter
2n/a
3n/adef get_tk_root():
4n/a try:
5n/a root = Tkinter._default_root
6n/a except AttributeError:
7n/a # it is possible to disable default root in Tkinter, although
8n/a # I haven't seen people doing it (but apparently someone did it
9n/a # here).
10n/a root = None
11n/a
12n/a if root is None:
13n/a # create a new master only if there isn't one already
14n/a root = Tkinter.Tk()
15n/a
16n/a return root
17n/a
18n/adef root_deiconify():
19n/a root = get_tk_root()
20n/a root.deiconify()
21n/a
22n/adef root_withdraw():
23n/a root = get_tk_root()
24n/a root.withdraw()
25n/a
26n/a
27n/adef simulate_mouse_click(widget, x, y):
28n/a """Generate proper events to click at the x, y position (tries to act
29n/a like an X server)."""
30n/a widget.event_generate('<Enter>', x=0, y=0)
31n/a widget.event_generate('<Motion>', x=x, y=y)
32n/a widget.event_generate('<ButtonPress-1>', x=x, y=y)
33n/a widget.event_generate('<ButtonRelease-1>', x=x, y=y)