查看
compound标签上的选项。它使您可以指定标签与文本的关系(顶部,底部,左侧,右侧,无)。
例如:
import Tkinter as tkclass View(tk.frame): def __init__(self, *args, **kwargs): tk.frame.__init__(self, *args, **kwargs) self.image = tk.PhotoImage(file="somefile.gif") b = tk.Button(self, text="Hello, world", image=self.image, compound="left") b.pack(side="top")if __name__ == "__main__": root = tk.Tk() view = View(root) view.pack(side="top", fill="both", expand=True) root.mainloop()



