【发布时间】:2019-10-18 02:32:19
【问题描述】:
我有一个要在 tkinter 窗口上显示的菜单列表,但是我如何以这样的方式显示菜单,它会先显示左然后右,然后转到下一行,然后再左再右。
现在,我正在使用 place 方法来增加 y 轴,因此每个标签都会下降 50。但不知道如何处理 x 轴以使其正确。
from tkinter import *
root = Tk()
root.geometry("800x500")
mac_meal = {"McChicken": "$7.50", ..... }
i = 100
for key in mac_meal:
meal = key
Label(root, text=meal, font=("times", 12, "bold"), width=20).place(x=50,y=i)
i += 50
结果在 y 轴上确实下降了 50,但我无法左右交替。例如:
McChicken (1st in the dictionary) McSpicy (2nd in the dictionary)
CheeseBurger (3rd....) Nugget (4th..)
此外,是否可以在此菜单中设置滚动条,以便在超出窗口几何形状时可以滚动?
感谢您的帮助!
【问题讨论】:
标签: python-3.x tkinter