小编New*_*hon的帖子

Python Tkinter 输入框

再会。我正在尝试创建自己的输入框以在我的项目中使用。基本上我想做的是运行我的主表单,它将调用第二个表单。用户将提供有关第二个的一些数据,当按下第二个上的确定/关闭按钮时,数据将传回第一个。功能类似于输入框。这是我创建的内容,但我是 Python 新手,我不确定自己哪里出错了/我也无法快速确定何时返回。

我的课在这里


import tkinter as tk
class MainWindow():
    def __init__(self, parent):
        top = self.top = tk.Toplevel(parent)
        self.myLabel = tk.Label(top, text='Enter a Grouping Name')
        self.myLabel.pack()
        self.myEntryBox = tk.Entry(top)
        self.myEntryBox.focus_set()
        self.myEntryBox.pack()
        self.mySubmitButton = tk.Button(top, text='OK', command=self.DestWin)
        self.mySubmitButton.pack()
    def DestWin(self):
        self.top.destroy()
Run Code Online (Sandbox Code Playgroud)

调用方法在这里


abc=configurator.MainWindow(root)
Run Code Online (Sandbox Code Playgroud)

python tkinter

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×1

tkinter ×1