-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGUI_support.py
87 lines (62 loc) · 1.72 KB
/
GUI_support.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /usr/bin/env python
#
# Support module generated by PAGE version 4.10
# In conjunction with Tcl version 8.6
# Jan 26, 2018 01:33:27 AM
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
def set_Tk_var():
global tch64
global tch64_var
tch64 = StringVar()
tch64_var = IntVar(0)
def button_press(event):
widget = event.widget
element = widget.identify(event.x, event.y)
if "close" in element:
index = widget.index("@%d,%d" % (event.x, event.y))
widget.state(['pressed'])
widget._active = index
def button_release(event):
widget = event.widget
if not widget.instate(['pressed']):
return
element = widget.identify(event.x, event.y)
try:
index = widget.index("@%d,%d" % (event.x, event.y))
except TclError:
pass
if "close" in element and widget._active == index:
widget.forget(index)
widget.event_generate("<<NotebookTabClosed>>")
widget.state(["!pressed"])
widget._active = None
def mouse_over(event):
widget = event.widget
element = widget.identify(event.x, event.y)
if "close" in element:
widget.state(['alternate'])
else:
widget.state(['!alternate'])
def init(top, gui, *args, **kwargs):
global w, top_level, root
w = gui
top_level = top
root = top
def destroy_window():
# Function which closes the window.
global top_level
top_level.destroy()
top_level = None
if __name__ == '__main__':
import GUI
GUI.vp_start_gui()