''' Created on 1 mars 2017 @author: olivier.massot ''' from tkinter import ttk, Tk, Canvas, PhotoImage from tkinter.constants import CENTER class Application(ttk.Frame): def __init__(self, master=None): super().__init__(master) self.pack() self.create_widgets() def create_widgets(self): self.logo = PhotoImage(file="logo32.png") self.canvas = Canvas(self, width=100, height=100) self.canvas.create_image(20, 20, anchor=CENTER, image=self.logo) self.canvas.pack() self.hi_there = ttk.Button(self) self.hi_there["text"] = "Hello World\n(click me)" self.hi_there["command"] = self.say_hi self.hi_there.pack() self.quit = ttk.Button(self, text="QUIT", command=root.destroy) self.quit.pack() def say_hi(self): print("hi there, everyone!") root = Tk() app = Application(master=root) app.mainloop()