我正在使用 tkinter 和 Treeview 构建一个普通表。尽管我已经配置了设置,但水平滚动条可见但未激活。想知道代码有什么问题吗?
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.ttk import LabelFrame
from PIL import ImageTk, Image
from tkcalendar import Calendar
from tkinter import messagebox
import webbrowser
import datetime
from io import BytesIO
from tkinter import filedialog
login_window = tk.Tk()
login_window.geometry('950x600')
Table_frame = tk.Frame(login_window, bd=15, relief='ridge', width=900, height=200)
Table_frame.grid(row=3, column=0, sticky='nsew')
destination_table = ttk.Treeview(Table_frame)
destination_table.pack(fill=BOTH, expand=1)
scroll_x = ttk.Scrollbar(Table_frame, orient='horizontal')
scroll_x.configure(command=destination_table.xview)
scroll_x.pack(side=BOTTOM, fill=X)
destination_table.configure(xscrollcommand = scroll_x.set)
destination_table["columns"]=("destinationname", "rate", "description", "estimatedprice","address", "contact", "operationtime", "type", "tags")
destination_table["show"] = "headings"
destination_table.heading("destinationname", text="Destination Name")
destination_table.heading("rate", text="Ratings")
destination_table.heading("description", text="Description")
destination_table.heading("estimatedprice", text="Estimated Price")
destination_table.heading("address", text="Address")
destination_table.heading("contact", text="Contact")
destination_table.heading("operationtime", text="Operation Time")
destination_table.heading("type", text="Destination type")
destination_table.heading("tags", text="Tags")
destination_table.column("destinationname", width=100)
login_window.mainloop()