从组合框返回值



如何返回在此组合框中选择的值

combobox_label = tk.Label(top_level, text="How many marks?", font=('Helvetica', 12, 'bold'))
combobox= ttk.Combobox(top_level)
combobox['values'] = [int(i) for i in range(0, marks+1)]
combobox_label.pack()
combobox.pack()

您需要将textvariable放入组合框中

value_for_combobox = ttk.StringVar()
combobox_label = ttk.Combobox((top_level, text="How many marks?", textvariable = value_for_combobox )

相关内容

  • 没有找到相关文章

最新更新