赞
踩
好用,实用!
https://gitcode.net/mirrors/cdhigh/Visual-Tkinter-for-Python (https://github.com/cdhigh/tkinter-designer )
designer 插件 + vb6精简版下载:
https://download.csdn.net/download/bigcarp/83379514
以下的控件需要在VB的'控件工具箱'中按右键添加'部件',选择“Microsoft Windows Common Controls 6.0” 和 "Microsoft Common Dialog Control 6.0"
ProgressBar、TreeView、TabStrip(对应到Python的Notebook)
CommonDialog -Microsoft Common Dialog Control 6.0(在Python代码中导入 filedialog、simpledialog、colorchooser这三个模块)
生成UI代码
- from tkinter import *
- from tkinter.font import Font
- from tkinter.ttk import *
- from tkinter.messagebox import *
-
-
- class Application_ui(Frame):
- def __init__(self, master=None):
- Frame.__init__(self, master)
- self.master.title('Tkinter Designer Demo')
- self.master.geometry('300x300')
- self.createWidgets()
-
- def createWidgets(self):
- self.top = self.winfo_toplevel()
-
- self.btnTest = Button(self.top, text='测试按钮')
- self.btnTest.place(x=90, y=60, width=100, height=30)
-
-
- if __name__ == "__main__":
- top = Tk()
- app = Application_ui(top)
- app.mainloop()
补充:
Application_ui(Frame) 这个类为什么要继承 Frame 呢?不继承可以吗?
可以,直接Application_ui()也是可以的。具体可对比 visualtk.com 生成的代码:
不继承的话,就要用top.mainloop(),不能用app.mainloop()
里面的self.master、self.winfo_toplevel 要改回master、master.winfo_toplevel
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。