Exemple #1
0
 def __init__(self):
     self.window = Tk()
     self.window.title("Dimens Convert Tool")
     windowW = 420
     if (platform.system() == "Windows"):
         windowW = 420
     else:
         windowW = 490
     self.window.minsize(windowW, 355)
     self.center_wind(self.window, windowW, 355)
     frame = Frame(self.window)
     frame.pack()
     config_path = os.path.split(
         os.path.realpath(__file__))[0] + "/" + "configs.ini"
     self.rootDir = os.path.split(os.path.realpath(__file__))[0]
     self.config_path = config_path
     conf = ConfigUtils.Config(config_path)
     self.conf = conf
     fontSize = 35
     menubar = Menu(self.window)
     helpmenu = Menu(menubar, tearoff=0)
     helpmenu.add_command(label="使用方法", command=self.help)
     helpmenu.add_separator()
     helpmenu.add_command(label="关于", command=self.about)
     menubar.add_cascade(label="帮助", menu=helpmenu)
     self.window.config(menu=menubar)
     index = 0
     designDevice = DesignDevice.Design(conf, index, frame, fontSize,
                                        self.rootDir)
     index = designDevice.layout()
     self.designDevice = designDevice
     targetDevice = TargetDevice.Design(conf, index, frame, fontSize)
     index = targetDevice.layout()
     self.targetDevice = targetDevice
     btApply = Button(frame, text="生成", command=self.processButtonGeneral)
     btApply.grid(row=index + 1, column=1, columnspan=2)
     btCancel = Button(frame, text="取消", command=self.processButtonCancel)
     btCancel.grid(row=index + 1, column=2, columnspan=2)
     # 监测事件直到window被关闭
     self.window.mainloop()