Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我的窗口赢了';我没有出现_Python - Fatal编程技术网

Python 我的窗口赢了';我没有出现

Python 我的窗口赢了';我没有出现,python,Python,嗨,我正在做这个Tkinter任务,我不知道为什么即使我把主循环放进去它也不会运行 # Importing Tkinter to display the graphics import Tkinter # Creating a class called StoryMaker class StoryMaker: # The initializer with the self parameter def __init__(self): # This creates

嗨,我正在做这个Tkinter任务,我不知道为什么即使我把主循环放进去它也不会运行

# Importing Tkinter to display the graphics
import Tkinter

# Creating a class called StoryMaker
class StoryMaker:
    # The initializer with the self parameter
    def __init__(self):
        # This creates the main window
        self.main_window = Tkinter.Tk()

        # This creates the three different frames for different widgets
        self.top_frame = Tkinter.Frame(self.main_window)
        self.mid_frame = Tkinter.Frame(self.main_window)
        self.bottom_frame = Tkinter.Frame(self.main_window)

        # Instructs the user to enter the information given to create the story
        self.story_label = Tkinter.Label (self.top_frame, text = "Please enter the information given for the new story, then click the \"Make Story\" Button!" )
        self.prompt_label1 = Tkinter.Label (self.top_frame, text = "Character Name: ")
        self.get_prompt1 = Tkinter.Entry (self.top_frame, width = 10)

        self.story_label.pack (side = 'left')
        story.prompt_label.pack (side = 'left')
        self.get_prompt1.pack (side = 'left')

        self.prompt_label2 = Tkinter.Label (self.mid_frame, text = "Place: ")
        self.get_prompt2 = Tkinter.Entry (self.mid_frame, width = 10)

        self.prompt_label3 = Tkinter.Label (self.mid_frame, text = "Food: ")
        self.get_prompt3 = Tkinter.Entry (self.mid_frame, width = 10)

        self.radio_var = Tkinter.IntVar()
        self.radio_var.set(1)

        self.prompt_label4 = Tkinter.Label(self.mid_frame, text = "Hotels")
        self.rb1 = Tkinter.Radiobutton(self.mid_frame, text = "Hilton", variable = self.radio_var, value = 1)
        self.rb2 = Tkinter.Radiobutton(self.mid_frame, text = "Burj Al Arab", variable = self.radio_var, value = 2)
        self.rb3 = Tkinter.Radiobutton(self.mid_frame, text = "Holiday Inn", variable = self.radio_var, value = 3)

        self.rb1.pack()
        self.rb2.pack()
        self.rb3.pcak()

        self.cb_var1 = Tkinter.IntVar()
        self.cb_var2 = Tkinter.IntVar()
        self.cb_var3 = Tkinter.IntVar()

        self.cb_var1.set(0)
        self.cb_var2.set(0)
        self.cb_var3.set(0)

        self.prompt_label5 = Tkinter.Label (self.mid_frame, text = "Foods")
        self.cb1 = Tkinter.Checkbutton (self.top_frame, text = "Pizza", variable = self.cb_var1)
        self.cb2 = Tkinter.Checkbutton (self.top_frame, text = "Spaghetti", variable = self.cb_var2)
        self.cb3 = Tkinter.Checkbutton (self.top_frame, text = "Hamburger", variable = self.cb_var3)

        self.cb1.pack()
        self.cb2.pack()
        self.cb3.pack()

        self.create_button = Tkinter.Button(self.bottom_frame, text = "Create", command = self.story)
        self.quit_button = Tkinter.Button(self.bottom_frame, text = "Quit", command = self.main_window.quit)

        self.create_button.pack(side = 'left')
        self.quit_button.pack(side = 'left')

        self.top_frame.pack()
        self.mid_frame.pack()
        self.bottom_frame.pack()

        Tkinter.mainloop()

my_gui = StoryMaker

最后一行实际上应该调用您刚才花费所有时间构建的类:

my_gui = StoryMaker()

看看这对你有什么好处。执行此操作将执行特殊的
\uuuu init\uuu()
方法,并运行GUI。

是否收到任何错误消息?如果是,什么?