只是标题中的问题“为什么 NoneType 什么时候应该是 Label?” 以及如何解决它才能修改onComboBoxChange中的标签文本?
label1 = Tkinter.Label( frame, text = '1.0' ).grid( row = 4, column = 5 )
nums = ( 'one', 'two' )
v1 = Tkinter.StringVar()
v1.trace( 'w',
lambda name, index, mode, sv = v1: self.onComboboxChange( sv, label1 ) )
ttk.Combobox( frame, textvar = v1, values = nums,
state = 'readonly', width = 14 ).grid( row = 2, column = 1 )
def onComboboxChange( self, sv, label ):
label.config( text = 'smth' ) # ------------- why do I get NoneType here?