Seite 1 von 1

Bild im Button (zum wiederhohlten mal)

Verfasst: Dienstag 5. April 2005, 21:11
von Arminius
Hallo, ich weis, das wurde hier schon oft gefragt, aber warum geht das nicht :cry: :

Code: Alles auswählen

from Tkinter import *

class App:

    def __init__(self, master):

        frame = Frame(master)
        frame.pack()
        ima = PhotoImage(file='C:\x.bmp')
        self.button = Button(frame, image=ima, command=tk.destroy)
        self.button.pack(side=LEFT)

        self.hi_there = Button(frame, text="Hello", command=self.say_hi)
        self.hi_there.pack(side=LEFT)

    def say_hi(self):
        print "hi there, everyone!"

root = Tk()

app = App(root)

root.mainloop()

kann mir wer helfen?

Verfasst: Dienstag 5. April 2005, 21:28
von mawe
Hi!

Richtig, die Frage wurde schon gestellt (von mir :wink:). Hier findest Du die Antwort.

Gruß, mawe