Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # GUI module generated by PAGE version 4.27f
- # in conjunction with Tcl version 8.6
- # Dec 02, 2019 02:33:12 PM CST platform: Linux
- import sys
- try:
- import Tkinter as tk
- except ImportError:
- import tkinter as tk
- try:
- import ttk
- py3 = False
- except ImportError:
- import tkinter.ttk as ttk
- py3 = True
- import depickle1_support
- def vp_start_gui():
- '''Starting point when module is the main routine.'''
- global val, w, root
- root = tk.Tk()
- depickle1_support.set_Tk_var()
- top = Toplevel1 (root)
- depickle1_support.init(root, top)
- root.mainloop()
- w = None
- def create_Toplevel1(root, *args, **kwargs):
- '''Starting point when module is imported by another program.'''
- global w, w_win, rt
- rt = root
- w = tk.Toplevel (root)
- depickle1_support.set_Tk_var()
- top = Toplevel1 (w)
- depickle1_support.init(w, top, *args, **kwargs)
- return (w, top)
- def destroy_Toplevel1():
- global w
- w.destroy()
- w = None
- class Toplevel1:
- def __init__(self, top=None):
- '''This class configures and populates the toplevel window.
- top is the toplevel containing window.'''
- _bgcolor = '#d9d9d9' # X11 color: 'gray85'
- _fgcolor = '#000000' # X11 color: 'black'
- _compcolor = '#d9d9d9' # X11 color: 'gray85'
- _ana1color = '#d9d9d9' # X11 color: 'gray85'
- _ana2color = '#ececec' # Closest X11 color: 'gray92'
- font9 = "-family {DejaVu Sans} -size 9"
- self.style = ttk.Style()
- if sys.platform == "win32":
- self.style.theme_use('winnative')
- self.style.configure('.',background=_bgcolor)
- self.style.configure('.',foreground=_fgcolor)
- self.style.map('.',background=
- [('selected', _compcolor), ('active',_ana2color)])
- top.geometry("670x670+688+154")
- top.minsize(1, 1)
- top.maxsize(1905, 1050)
- top.resizable(1, 1)
- top.title("New Toplevel")
- top.configure(highlightcolor="black")
- self.Entry1 = tk.Entry(top)
- self.Entry1.place(relx=0.015, rely=0.112,height=31, relwidth=0.666)
- self.Entry1.configure(background="white")
- self.Entry1.configure(font="-family {DejaVu Sans Mono} -size 9")
- self.Entry1.configure(selectbackground="#c4c4c4")
- self.Entry1.configure(textvariable=depickle1_support.entry_var)
- self.btnFile = tk.Button(top)
- self.btnFile.place(relx=0.682, rely=0.112, height=31, width=40)
- self.btnFile.configure(activebackground="#f9f9f9")
- self.btnFile.configure(command=depickle1_support.on_btnFile)
- self.btnFile.configure(font="-family {Ubuntu} -size 11 -weight bold")
- self.btnFile.configure(text='''...''')
- self.btnGo = tk.Button(top)
- self.btnGo.place(relx=0.761, rely=0.112, height=29, width=101)
- self.btnGo.configure(activebackground="#f9f9f9")
- self.btnGo.configure(command=depickle1_support.on_btnGo)
- self.btnGo.configure(font="-family {Ubuntu} -size 11 -weight bold")
- self.btnGo.configure(text='''GO!''')
- self.Scrolledtext1 = ScrolledText(top)
- self.Scrolledtext1.place(relx=0.015, rely=0.299, relheight=0.694
- , relwidth=0.978)
- self.Scrolledtext1.configure(background="white")
- self.Scrolledtext1.configure(font=font9)
- self.Scrolledtext1.configure(insertborderwidth="3")
- self.Scrolledtext1.configure(selectbackground="#c4c4c4")
- self.Scrolledtext1.configure(wrap="none")
- self.btnExit = tk.Button(top)
- self.btnExit.place(relx=0.881, rely=0.03, height=31, width=65)
- self.btnExit.configure(activebackground="#f9f9f9")
- self.btnExit.configure(command=depickle1_support.on_btnExit)
- self.btnExit.configure(font="-family {Ubuntu} -size 11 -weight bold")
- self.btnExit.configure(text='''EXIT!''')
- self.Label1 = tk.Label(top)
- self.Label1.place(relx=0.036, rely=0.224, height=19, width=136)
- self.Label1.configure(activebackground="#f9f9f9")
- self.Label1.configure(anchor='e')
- self.Label1.configure(font="-family {Ubuntu} -size 11 -weight bold")
- self.Label1.configure(text='''Pickle Data Type:''')
- self.Label2 = tk.Label(top)
- self.Label2.place(relx=0.245, rely=0.224, height=29, width=456)
- self.Label2.configure(activebackground="#f9f9f9")
- self.Label2.configure(borderwidth="3")
- self.Label2.configure(font="-family {Ubuntu} -size 11 -weight bold -slant italic")
- self.Label2.configure(relief="ridge")
- self.Label2.configure(text='''Label''')
- self.Label2.configure(textvariable=depickle1_support.pickleType)
- # The following code is added to facilitate the Scrolled widgets you specified.
- class AutoScroll(object):
- '''Configure the scrollbars for a widget.'''
- def __init__(self, master):
- # Rozen. Added the try-except clauses so that this class
- # could be used for scrolled entry widget for which vertical
- # scrolling is not supported. 5/7/14.
- try:
- vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
- except:
- pass
- hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)
- try:
- self.configure(yscrollcommand=self._autoscroll(vsb))
- except:
- pass
- self.configure(xscrollcommand=self._autoscroll(hsb))
- self.grid(column=0, row=0, sticky='nsew')
- try:
- vsb.grid(column=1, row=0, sticky='ns')
- except:
- pass
- hsb.grid(column=0, row=1, sticky='ew')
- master.grid_columnconfigure(0, weight=1)
- master.grid_rowconfigure(0, weight=1)
- # Copy geometry methods of master (taken from ScrolledText.py)
- if py3:
- methods = tk.Pack.__dict__.keys() | tk.Grid.__dict__.keys() \
- | tk.Place.__dict__.keys()
- else:
- methods = tk.Pack.__dict__.keys() + tk.Grid.__dict__.keys() \
- + tk.Place.__dict__.keys()
- for meth in methods:
- if meth[0] != '_' and meth not in ('config', 'configure'):
- setattr(self, meth, getattr(master, meth))
- @staticmethod
- def _autoscroll(sbar):
- '''Hide and show scrollbar as needed.'''
- def wrapped(first, last):
- first, last = float(first), float(last)
- if first <= 0 and last >= 1:
- sbar.grid_remove()
- else:
- sbar.grid()
- sbar.set(first, last)
- return wrapped
- def __str__(self):
- return str(self.master)
- def _create_container(func):
- '''Creates a ttk Frame with a given master, and use this new frame to
- place the scrollbars and the widget.'''
- def wrapped(cls, master, **kw):
- container = ttk.Frame(master)
- container.bind('<Enter>', lambda e: _bound_to_mousewheel(e, container))
- container.bind('<Leave>', lambda e: _unbound_to_mousewheel(e, container))
- return func(cls, container, **kw)
- return wrapped
- class ScrolledText(AutoScroll, tk.Text):
- '''A standard Tkinter Text widget with scrollbars that will
- automatically show/hide as needed.'''
- @_create_container
- def __init__(self, master, **kw):
- tk.Text.__init__(self, master, **kw)
- AutoScroll.__init__(self, master)
- import platform
- def _bound_to_mousewheel(event, widget):
- child = widget.winfo_children()[0]
- if platform.system() == 'Windows' or platform.system() == 'Darwin':
- child.bind_all('<MouseWheel>', lambda e: _on_mousewheel(e, child))
- child.bind_all('<Shift-MouseWheel>', lambda e: _on_shiftmouse(e, child))
- else:
- child.bind_all('<Button-4>', lambda e: _on_mousewheel(e, child))
- child.bind_all('<Button-5>', lambda e: _on_mousewheel(e, child))
- child.bind_all('<Shift-Button-4>', lambda e: _on_shiftmouse(e, child))
- child.bind_all('<Shift-Button-5>', lambda e: _on_shiftmouse(e, child))
- def _unbound_to_mousewheel(event, widget):
- if platform.system() == 'Windows' or platform.system() == 'Darwin':
- widget.unbind_all('<MouseWheel>')
- widget.unbind_all('<Shift-MouseWheel>')
- else:
- widget.unbind_all('<Button-4>')
- widget.unbind_all('<Button-5>')
- widget.unbind_all('<Shift-Button-4>')
- widget.unbind_all('<Shift-Button-5>')
- def _on_mousewheel(event, widget):
- if platform.system() == 'Windows':
- widget.yview_scroll(-1*int(event.delta/120),'units')
- elif platform.system() == 'Darwin':
- widget.yview_scroll(-1*int(event.delta),'units')
- else:
- if event.num == 4:
- widget.yview_scroll(-1, 'units')
- elif event.num == 5:
- widget.yview_scroll(1, 'units')
- def _on_shiftmouse(event, widget):
- if platform.system() == 'Windows':
- widget.xview_scroll(-1*int(event.delta/120), 'units')
- elif platform.system() == 'Darwin':
- widget.xview_scroll(-1*int(event.delta), 'units')
- else:
- if event.num == 4:
- widget.xview_scroll(-1, 'units')
- elif event.num == 5:
- widget.xview_scroll(1, 'units')
- if __name__ == '__main__':
- vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement