-3
私は今Python(2.7)を使っていますが、クラスを使い始めました。それはGameIntroが定義されていないことを私に伝えます。私はそれを修正しようとしてきたが、それが動作するように望んでいない:私が定義した関数が定義されていないとPythonが言っているのはなぜですか?
import random
from Tkinter import *
import time
class win():
root = Tk()
root.wm_title("HauntFall")#Title of window
text1 = Label(root, text = "HAUNTFALL", font = ('MS Serif', 50, 'bold'), fg = "white", bg = "black")
text1.pack()#This one and^that one make the big lettered HauntFall.
butt1 = Button(root, text = "PLAY", font = ('MS Serif', 15, 'bold'), fg = 'red', command = GameIntro)
butt1.pack(pady = 3)#These two make the PLAY button.
root.configure(bg='black')#This one sets the background to black.
root.mainloop()#Puts the window in a loop, so it doesn't immediately close.
def GameIntro():
x = win()
print "Gj"
x.text1.configure(font = ('MS Serif', 12, 'bold'),text = "You approach a house abandoned many years ago - though you can hear faint creaking, and various other noises coming from inside it's shadowy depths. You approach the large wooden doors, and stare up at all 3 stories of the horrifing place. The house has always been a mystery, and although you are the curious type, you have been hesitant to go in. You promise yourself not to succumb to your fears, and you pull open the old wooden doors.", wraplength = 500)
x.butt1.configure(text = 'Continue', font = ('MS Serif', 12, 'bold'))
。 –
これが有効なPythonコードのような行 'クラスの勝利の後には、インデント()がないように、それは、見ていません:' – jolvi
私はクラスの上GameIntroを入れてみましたが、それはテキスト1とbutt1のような変数がなかったことを言いました作業 – DefecateRainbows