You can use the label to display PhotoImage and BitmapImage objects. When doing this, make sure you keep a reference to the image object, to prevent it from being garbage collected by Python’s memory allocator. You can use a global variable or an instance attribute, or easier, just add an attribute to the widget instance:
image
参数不接受文件名。根据this教程,“值应该是PhotoImage、BitmapImage或兼容对象。”接着讨论了PhotoImage
类,您应该改用它。你知道吗相关问题 更多 >
编程相关推荐