2013-05-05 54 views
0

我正在創建一個GUI應用程序,可以讓您從當日服務器的不同報價中查看當天的報價。我在網格佈局中使用了Tkinter(之前我使用過包裝,但效果並不理想)。這就是我現在所擁有的:Tkinter(Python)佈局問題

QOTD Viewer Current Layout

我的問題是,我想文本框和「查看QOTD」按鈕旁邊的「服務器地址」標籤。我嘗試了幾件事,但他們沒有工作。我的代碼如下:

from Tkinter import * 

class qotdApp: 

    def __init__(self, master): 

     frame = Frame(master) 
     frame.pack() 

     self.prompt = Label(frame, text="Server Address: ") 
     self.prompt.grid(row=0, column=0, sticky=W) 

     self.sAEntry = Entry(frame) 
     self.sAEntry.grid(row=0, column=1, sticky=W) 

     self.go = Button(frame, text="View QOTD", command=self.reportAddress) 
     self.go.grid(row=0, column=2, sticky=W) 

     self.viewQuote = Text(frame, height=5) 
     self.viewQuote.grid(row=1, rowspan=3) 

     frame.columnconfigure(2, weight=4) 

    def reportAddress(self): 

     print self.sAEntry.get() 


root = Tk(className='quote of the day viewer') 
app = qotdApp(root) 

root.mainloop() 

回答

2

它看起來像你使用rowspan時,你應該使用columnspan。你希望它跨越三列,而不是三列。