'''
WxPython可视化编辑器:https://bbs.125.la/forum.php?mod=viewthread&tid=14628653
Python3 Tkinter可视化窗口组件设计器:https://bbs.125.la/forum.php?mod=viewthread&tid=14519599
'''
import tkinter as tk
class PyWinDesign:
def __init__(self, form):
self.form = form
self.form.title('')
self.form.resizable(width=False, height=False)
screenwidth = self.form.winfo_screenwidth()
screenheight = self.form.winfo_screenheight()
size = '%dx%d+%d+%d' % (333, 210, (screenwidth - 333) / 2, (screenheight - 210) / 2)
self.form.geometry(size)
self.username = tk.Text(self.form, wrap=tk.NONE, pady=8)
self.username.insert(tk.END, '')
self.username.place(x=58, y=21, width=253, height=32)
self.password = tk.Text(self.form, wrap=tk.NONE, pady=8)
self.password.insert(tk.END, '')
self.password.place(x=58, y=84, width=254, height=32)
self.Label1_title = tk.StringVar()
self.Label1_title.set('帐号')
self.Label1 = tk.Label(self.form, textvariable=self.Label1_title, anchor=tk.W)
self.Label1.place(x=16, y=25, width=32, height=22)
self.Label2_title = tk.StringVar()
self.Label2_title.set('密码')
self.Label2 = tk.Label(self.form, textvariable=self.Label2_title, anchor=tk.W)
self.Label2.place(x=17, y=89, width=31, height=22)
self.Button1_title = tk.StringVar()
self.Button1_title.set('登录')
self.Button1 = tk.Button(self.form, textvariable=self.Button1_title, command=self.login)
self.Button1.place(x=115, y=142, width=104, height=35)
def login(self):
print(self.username.get("1.0", "end"))
print(self.password.get("1.0", "end"))
if __name__ == '__main__':
root = tk.Tk()
app = PyWinDesign(root)
root.mainloop()
Python3 Tkinter可视化窗口组件设计器
最新推荐文章于 2024-07-31 14:30:10 发布