是以,我正在開發我的第一個“大型”python項目(第二個GUI),它是一個簡單的SQLite資料庫管理器。到目前為止,這是它的樣子,當它正确的配合。。。
問題是,如果你有足夠多的列,GUI會因為treeview而擴充到螢幕的邊緣,而不是讓我使用treeview上的滾動條來檢視其餘的列,它隻是把它們切斷了。在
這是問題的圖檔。
正如您可以清楚地看到,表的其餘部分被切斷,而滾動條也被禁用。在
下面是我用來建立treeview表的代碼。在def table (self, root, c, table, list_columns):
self.tree = Treeview(root)
self.tree['show'] = 'headings'
self.tree["columns"] = list_columns
self.ysb = Scrollbar(root, orient='vertical', command=self.tree.yview)
self.xsb = Scrollbar(root, orient='horizontal', command=self.tree.xview)
self.tree.configure(yscroll=self.ysb.set, xscroll=self.xsb.set)
for column in list_columns:
self.tree.column(column)
self.tree.heading(column, text=column.capitalize())
self.tree.column("#1", width=50)
self.tree.bind("", self.onClick)
result = c.execute("SELECT rowid, * FROM " + table)
ROWID = 1
for r in result:
self.tree.insert("", END, iid=ROWID)
pos = 0
for c in r:
self.tree.set(ROWID, column=pos, value=str(c))
pos = pos + 1
ROWID = ROWID + 1
self.tree.grid(row=1, column=0, columnspan=8)
self.ysb.grid(row=1, column=9, sticky='ns')
self.xsb.grid(row=2, column=0, sticky='ew', columnspan=8)
self.rowTotal = 3
是以謝謝你的幫助,如果你還需要什麼,請告訴我!在
編輯:
是以我試着把treeview插入到它自己的架構中,把架構的寬度設定為一個常量,不允許架構調整大小,但是這也不起作用。。。在