Python3 Tkinter可视化窗口组件设计器

'''
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()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

光明有我16620122910

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值