我正在创建一个需要 tkinter 组合框的应用程序。我希望组合框从应用程序启动时就具有默认值。我已经尝试过current()方法但它不起作用。
这是我的代码片段
n= tk.StringVar()
youtubechoicesLabel = ttk.Combobox(root, font=font, justify='center', textvariable=n)
youtubechoicesLabel['values'] = ("----Download Type----",
"Mp4 720p",
"Mp4 144p",
"Video 3gp",
"Audio Mp3")
youtubechoicesLabel.current(0)
youtubechoicesLabel["background"] = '#ff0000'
youtubechoicesLabel["foreground"] = '#ffffff'
youtubechoicesLabel.pack(side=TOP, pady=20)
守候你守候我
蓝山帝景
茅侃侃
相关分类