我想减小列的宽度,以便变得合适。正如您在此处看到的(https://i.stack.imgur.com/VK6w8.png),表格不规则,有些列不可见。我怎么解决这个问题?
这是我的代码:
def show():
# connect to database if exist or if doesnt exit create one
conn= sqlite3.connect("Books_table.bd")
#create cursors
Cursor = conn.cursor()
Cursor.execute("SELECT * , oid FROM books")
records = Cursor.fetchall()
Query_window = Toplevel()
Query_window.title("Show Table ...")
Frm = Frame(Query_window)
Frm.pack()
Table = ttk.Treeview(Frm , column = (1,2,3,4,5,6,7,8) , show = "headings" , height = 5 )
Table.pack()
Table.heading(1 , text = "Book name")
Table.heading(2 , text = "Book number")
Table.heading(3 , text = "Book writer")
Table.heading(4 , text = "Book subject")
Table.heading(5 , text = "Quantity")
Table.heading(6 , text = "Borrower")
Table.heading(7 , text = "Return date")
Table.heading(8 , text = "Availability")
# insert values to the table
for record in records:
Table.insert("", "end" , value = record )
#Commit changes
conn.commit()
#close database
conn.close()