Getting the selected value from combobox in Tkinter

前端 未结 2 1702
旧巷少年郎
旧巷少年郎 2020-12-06 12:47

I\'ve made a simple combobox in python using Tkinter, I want to retrieve the value selected by the user. After searching, I think I can do this by binding an event of select

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 13:08

    I've figured out what's wrong in the code.

    First, as James said the brackets should be removed when binding justamethod to the combobox.

    Second, regarding the type error, this is because justamethod is an event handler, so it should take two parameters, self and event, like this,

    def justamethod (self, event): 
    

    After making these changes the code is working well.

提交回复
热议问题