Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tkinter import *
- from aceutil import Log, TkUtils
- import traceback, os, sys
- ##FIXES--------------------------------------------------------
- if os.name == 'nt': #windows fix
- import win32api, win32con
- if getattr(sys, 'frozen', False): #windows path fix
- os.chdir(sys._MEIPASS)
- exe_path = os.path.dirname(sys.executable)
- elif __file__:
- exe_path = os.path.dirname(__file__)
- def retag(tag, *args): #for bind_class functions for multiple objects bound to same class
- for widget in args:
- widget.bindtags((tag,) + widget.bindtags())
- def no(): #fix for cButton function, used as a default command
- pass
- #--------------------------------------------------------------
- class GUI:
- def __init__(self):
- self.log = Log() ##uses the log file system from aceutil
- self.root = Tk() ##basic tkinter root window
- self.atk = TkUtils(self.log, self.root) ##Tkinter utilities
- self.active_window = None ##holder for the active window
- def create_window(self, event, title="", height=400, width=400): #create overlayed canvas
- try:
- self.active_window = self.atk.overlay(self.root, event, title, height=height, width=width)
- return "break"
- except Exception as err:
- exc_type, exc_obj, exc_tb = sys.exc_info()
- self.log.error("create_window failed\n%s, %s, %s, %s" %(err, exc_type, exc_obj, traceback.print_tb(exc_tb)))
- def clear_window(self, event): #clear overlayed canvas
- try:
- if self.active_window != None:
- self.active_window.destroy()
- return "break"
- except Exception as err:
- exc_type, exc_obj, exc_tb = sys.exc_info()
- self.log.error("clear_window failed\n%s, %s, %s, %s" %(err, exc_type, exc_obj, traceback.print_tb(exc_tb)))
- def basic_movable_window(self, event):
- try:
- self.create_window(event, title="Some Title", height=250, width =250)
- overlay = self.active_window
- holder= self.atk..cFrame(overlay, padx=5, pady=5)
- ## you frame to use is holder
- except Exception as err:
- exc_type, exc_obj, exc_tb = sys.exc_info()
- self.log.error("basic_movable_windowfailed\n%s, %s, %s, %s" %(err, exc_type, exc_obj, traceback.print_tb(exc_tb)))
- def basic_movable_scroll_window(self, event): #interface for the notification box
- try:
- self.active_window = self.atk.overlay(self.root, title="Some Title", height=250, width =250)
- overlay = self.active_window
- infill = self.atk.cFrame(overlay, bg="white", padx=5, pady=5, fill=BOTH, expand=1)
- scroll, can3 = self.atk.scrollable_area2(infill)
- self.root.update_idletasks()
- self.root.update()
- self.atk.set_pos(overlay)
- holder = self.atk.cFrame(scroll, side=TOP, bg="white", padx=5, pady=5, fill=BOTH, expand=1)
- ## you frame to use is holder
- ##Your code goes Here
- except Exception as err:
- exc_type, exc_obj, exc_tb = sys.exc_info()
- self.log.error("basic_movable_scroll_windowfailed\n%s, %s, %s, %s" %(err, exc_type, exc_obj, traceback.print_tb(exc_tb)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement