|
| 1 | +#! /usr/bin/env python |
| 2 | +# |
| 3 | +# Support module generated by PAGE version 4.10 |
| 4 | +# In conjunction with Tcl version 8.6 |
| 5 | +# Jan 26, 2018 01:33:27 AM |
| 6 | + |
| 7 | + |
| 8 | +import sys |
| 9 | + |
| 10 | +try: |
| 11 | + from Tkinter import * |
| 12 | +except ImportError: |
| 13 | + from tkinter import * |
| 14 | + |
| 15 | +try: |
| 16 | + import ttk |
| 17 | + py3 = 0 |
| 18 | +except ImportError: |
| 19 | + import tkinter.ttk as ttk |
| 20 | + py3 = 1 |
| 21 | + |
| 22 | +def set_Tk_var(): |
| 23 | + global tch64 |
| 24 | + global tch64_var |
| 25 | + tch64 = StringVar() |
| 26 | + tch64_var = IntVar(0) |
| 27 | + |
| 28 | +def button_press(event): |
| 29 | + |
| 30 | + widget = event.widget |
| 31 | + |
| 32 | + element = widget.identify(event.x, event.y) |
| 33 | + |
| 34 | + if "close" in element: |
| 35 | + index = widget.index("@%d,%d" % (event.x, event.y)) |
| 36 | + widget.state(['pressed']) |
| 37 | + widget._active = index |
| 38 | + |
| 39 | +def button_release(event): |
| 40 | + |
| 41 | + widget = event.widget |
| 42 | + |
| 43 | + if not widget.instate(['pressed']): |
| 44 | + return |
| 45 | + |
| 46 | + element = widget.identify(event.x, event.y) |
| 47 | + |
| 48 | + try: |
| 49 | + index = widget.index("@%d,%d" % (event.x, event.y)) |
| 50 | + except TclError: |
| 51 | + pass |
| 52 | + |
| 53 | + if "close" in element and widget._active == index: |
| 54 | + widget.forget(index) |
| 55 | + widget.event_generate("<<NotebookTabClosed>>") |
| 56 | + |
| 57 | + widget.state(["!pressed"]) |
| 58 | + widget._active = None |
| 59 | + |
| 60 | +def mouse_over(event): |
| 61 | + |
| 62 | + widget = event.widget |
| 63 | + element = widget.identify(event.x, event.y) |
| 64 | + |
| 65 | + if "close" in element: |
| 66 | + widget.state(['alternate']) |
| 67 | + |
| 68 | + else: |
| 69 | + widget.state(['!alternate']) |
| 70 | + |
| 71 | +def init(top, gui, *args, **kwargs): |
| 72 | + global w, top_level, root |
| 73 | + w = gui |
| 74 | + top_level = top |
| 75 | + root = top |
| 76 | + |
| 77 | +def destroy_window(): |
| 78 | + # Function which closes the window. |
| 79 | + global top_level |
| 80 | + top_level.destroy() |
| 81 | + top_level = None |
| 82 | + |
| 83 | +if __name__ == '__main__': |
| 84 | + import GUI |
| 85 | + GUI.vp_start_gui() |
| 86 | + |
| 87 | + |
0 commit comments