def target_tool(self, e=None): toolTarget = get_variable('toolTarget') if (toolTarget != None): toolTarget.config(relief=FLAT) self.config(relief=GROOVE) set_variable('toolTarget', self)
def __initUI(self): self.pack(side=LEFT, fill="y") cursor = Tool(self, 'cursor', 'cursor-32.png') cursor.target_tool() createNode = Tool(self, 'create-node', 'circle-32.png') relationship = Tool(self, 'relationship', 'up-arrow-32.png') set_variable("toolList", [cursor, createNode, relationship])
def main_window(self, window): style.CreateStyle(self._window) top.TopFrame(self._window) bottom.BottomFrame(self._window) tool.ToolLeft(self._window) tab.TabFrame(self._window) ppts = properties.Properties(self._window) set_variable("properties", ppts)
def __initUI(self): self.pack(side=LEFT, fill="both", expand=True) tabControl = Notebook(self) tabControl.pack(side=LEFT, fill="both", expand=True) tab1 = graph.GraphFrame(self._parent) tab2 = matrix.MatrixFrame(self._parent) tabControl.add(tab1, text="Cây") tabControl.add(tab2, text="Ma trận") set_variable("matrix", tab2) set_variable("tabControl", tabControl)
def doLogin(self): username = self.username.get() password = self.password.get() res = dbcontent.user_login(username, password) if res is True: # if username == "admin" and password == "admin": # 测试账号 self.page.destroy() glv.set_variable("CURRENT_USER_NAME", str(username)) MainPage(self.root) else: messagebox.showinfo(title="错误", message="账号或密码错误!")
def __initUI(self): self.pack(side=LEFT, fill="both", expand=True) self._canvas = Canvas(self,bg=WHITE,bd=0, highlightthickness=0) self._canvas.pack(fill="both", expand=True, padx=5, pady=5) self.item = None self.previous = (0,0) self._canvas.bind('<Button-1>',self.mouse_event) self._canvas.bind('<B1-Motion>',self.drag) self._canvas.bind('<ButtonRelease-1>',self.end_drag) self._parent.bind("<Key>",self.key_event) nodeList = get_variable("nodeList") A = Node(self._canvas,"A",1000,150,20,30) C = Node(self._canvas,"C",25,100,100,30) D = Node(self._canvas,"D",20,200,100,30) E = Node(self._canvas,"E",24,300,100,30) F = Node(self._canvas,"F",22,400,20,30) H = Node(self._canvas,"H",16,180,200,30) I = Node(self._canvas,"I",17,450,200,30) K = Node(self._canvas,"K",11,250,250,30) B = Node(self._canvas,"B",0,150,250,30) A.add_child(C,17) A.add_child(D,12) A.add_child(E,15) A.add_child(F,20) D.add_child(E,8) D.add_child(H,10) E.add_child(I,4) E.add_child(K,5) H.add_child(K,1) H.add_child(B,18) K.add_child(B,8) nodeList = [A,C,D,E,F,H,K,I,B] set_variable("nodeList",nodeList)
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import os from tkinter import Tk import lib.global_variable as glv from pages import win_login, win_splah # Load global variable management module glv.init_global_variable() glv.set_variable("APP_NAME", "Application") glv.set_variable("APP_PATH", os.path.dirname(__file__)) glv.set_variable("DATA_DIR", "data") class App(Tk): """Application Class""" def __init__(self): win_splah.Splah() Tk.__init__(self) # Login Window win_login.Login(self) self.mainloop() if __name__ == "__main__":
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- """Application""" import os from tkinter import Tk import lib.global_variable as gv from components import app_view gv.init_global_variable() gv.set_variable("APP_BUNDLE_ID", "org.crogram.blockchain-node") gv.set_variable("APP_NAME", "区块链客户端GUI") gv.set_variable("APP_PATH", os.path.dirname(__file__)) # 当前目录 gv.set_variable("APP_VERSION", "0.1.1") class App(Tk): """Application Class""" def __init__(self): Tk.__init__(self) app_view.client(self) self.mainloop() if __name__ == "__main__": App()