Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何减少树视图';s列';宽度是多少?_Python_Sqlite_Tkinter_Treeview_Ttkwidgets - Fatal编程技术网

Python 如何减少树视图';s列';宽度是多少?

Python 如何减少树视图';s列';宽度是多少?,python,sqlite,tkinter,treeview,ttkwidgets,Python,Sqlite,Tkinter,Treeview,Ttkwidgets,我想减小柱子的宽度,这样就更合适了。正如您在这里看到的()表是不规则的,有些列是不可见的。我怎样才能解决这个问题 这是我的密码: def show(): # connect to database if exist or if doesnt exit create one conn= sqlite3.connect("Books_table.bd") #create cursors Cursor = conn.cursor()

我想减小柱子的宽度,这样就更合适了。正如您在这里看到的()表是不规则的,有些列是不可见的。我怎样才能解决这个问题

这是我的密码:

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()

可以使用column()方法设置Treeview列的宽度

...
Table.heading(1, text="Book name")
Table.column(1, width=50)
...