1
在serparate文件中的follwing代碼工作正常。它正在創建一個文本區域併爲其添加一個滾動條。pykin Tkinter:滾動條沒有添加到文本區
root = Tkinter.Tk()
text=Text(root,height=10,width=50,background='pink')
scroll=Scrollbar(root)
text.configure(yscrollcommand=scroll.set)
scroll.config(command=text.yview)
text.pack(side=LEFT)
scroll.pack(side=RIGHT,fill=Y)
但完全相同的代碼是不是沃金,當它與其他代碼(main.py)
//================ other code
root = Tkinter.Tk()
root.geometry("800x600+100+0") # width, height, x ,y
button_1 = Button(root,text="iphone file")
button_1.pack()
button_1.grid(row=0, column=0)
button_1.configure(command=openFile)
//------------------ following is the same code
text=Text(root,height=10,width=50,background='pink')
scroll=Scrollbar(root)
text.configure(yscrollcommand=scroll.set)
scroll.config(command=text.yview)
text.pack(side=LEFT)
scroll.pack(side=RIGHT,fill=Y)
,當我從命令提示符運行main.py文件,它只是掛合併。這裏出了什麼問題?