使用 tkinter 使用列表框在多列中显示数组
Displaying an array in multiple columns using listbox using tkinter
我有一个列表,其值彼此无关,我将使用 Tkinter Listbox 显示它,但是所有数据都显示在带有滚动条的一列中,我怎样才能将它们显示在多列中,例如图片?
the list
请basic tutorial on tkinter. There you will be teached about events and event objects. Also look up in a good documentation让您了解事件的力量,请参阅下文。
import tkinter as tk
def highlight(event):
widget = event.widget
if str(event.type) == 'Enter':
widget.config(bg='blue')
elif str(event.type) == 'Leave':
widget.config(bg='#f0f0f0')
lng = ['Arabic','Bosnian','German','English']
root = tk.Tk()
for i in lng:
l = tk.Label(root,text=i)
l.pack(fill='x')
l.bind('<Enter>', highlight)
l.bind('<Leave>',highlight)
我有一个列表,其值彼此无关,我将使用 Tkinter Listbox 显示它,但是所有数据都显示在带有滚动条的一列中,我怎样才能将它们显示在多列中,例如图片?
the list
请basic tutorial on tkinter. There you will be teached about events and event objects. Also look up in a good documentation让您了解事件的力量,请参阅下文。
import tkinter as tk
def highlight(event):
widget = event.widget
if str(event.type) == 'Enter':
widget.config(bg='blue')
elif str(event.type) == 'Leave':
widget.config(bg='#f0f0f0')
lng = ['Arabic','Bosnian','German','English']
root = tk.Tk()
for i in lng:
l = tk.Label(root,text=i)
l.pack(fill='x')
l.bind('<Enter>', highlight)
l.bind('<Leave>',highlight)