我正在尝试*使用self这是我的选择代码:self.choices = glob.glob(os.path.join(self.directory, "*- to sign.jpg"))这是我的下拉选项菜单代码:self.popupMenu = OptionMenu(main, self.tkvar, self.*choices, command = func)self当我从这两个选择中删除时,它工作正常。但self它不起作用,这是我的错误: self.popupMenu = OptionMenu(main, self.tkvar, self.*choices, command = func) ^SyntaxError: invalid syntax这是工作代码:choices = glob.glob(os.path.join(directory, "*- to sign.jpg"))popupMenu = OptionMenu(main, tkvar, *choices, command = func)这是我厌倦了重写的代码:self.choices = glob.glob(os.path.join(self.directory, "*- to sign.jpg"))self.popupMenu = OptionMenu(main, self.tkvar, self.*choices, command = func)self.popupMenu.grid(row=1, column=0)为什么显示 SyntaxError: invalid Syntax as self.choices?
添加回答
举报
0/150
提交
取消