簡體   English   中英

如何“在一行中居中文本”tkinter treeview

[英]how to "center text in a row" tkinter treeview

我想在行中居中文本。 我將 tkinter 用於 GUI。 我應該使用哪個代碼以及在哪里?

tv1["column"]=list(pivot.columns)
tv1["show"] = "headings"
for column in tv1["columns"]:
    tv1.heading(column, text = column)
    
pivot_rows = pivot.to_numpy().tolist()
for row in pivot_rows:
    tv1.insert("","end", values=row)

圖形用戶界面

tv1["column"] = list(pivot.columns)
tv1["show"] = "headings"
for column in tv1["columns"]:
    tv1.column(column, anchor=CENTER) # This will center text in rows
    tv1.heading(column, text=column)
    
pivot_rows = pivot.to_numpy().tolist()
for row in pivot_rows:
    tv1.insert("","end", values=row)

文檔中找到

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM