小编Tee*_*ain的帖子

“变量”可能未定义或从星导入定义:tkinter

我正在尝试为 gui 制作一个简单的大纲,但我收到警告“变量”可能未定义或从 star 导入定义:我所有变量的 tkinter。

这是我的代码:

from tkinter import *

class myApp :
    def __init__(self, gui,) :
        self.root = gui
        self.bframe = Frame(self.root)  # Create a container Frame at bottom
        self.bframe.pack(side=BOTTOM)
        self.xlabel = Label(self.root, text="Item ID")  # Create the Label
        self.xlabel.pack(side=LEFT)
        self.xentry = Entry(self.root, bd=5)  # Create the Entry box
        self.xentry.pack(side=LEFT)
        self.xentry.bind('<Return>', self.showStockItem)
        self.xentry.focus_set()  # Set focus in the Entry box
        self.xopen = Button(self.root, text="Show", command=self.showStockItem) # Create the open Button
        self.xopen.pack(side=LEFT)
        self.xquit = Button(self.bframe, text="Quit", command=self.quitit) # Create …
Run Code Online (Sandbox Code Playgroud)

python tkinter

2
推荐指数
2
解决办法
8626
查看次数

标签 统计

python ×1

tkinter ×1