Hallo Leute, ich aheb eine kleines python Code geschrieben, der einen Button darstellt. Durch drücken des buttons soll "Hello World" ausgegeben werden. Soweit funktioniert es. Nun wollte ich, dass es beim Start einmal automatisch auf das Button gedrückt werden. Kriege ich es aber irgendwie nicht hin. Hat jemand eine idee? from tkinter import * root = Tk() #Create a Window root.title("Unser GUI Programm") root.geometry("400x500") #Size of window def ausgabe(): #Function for edition of strings on the console print("Hello World!") knopf1 = Button(root, text="Menu", command=ausgabe) #Creation of Button knopf1.pack() mainloop() Vielen Dank im Vorraus! Gruß Mirko
1 | from tkinter import * |
2 | |
3 | root = Tk() #Create a Window |
4 | root.title("Unser GUI Programm") |
5 | root.geometry("400x500") #Size of window |
6 | |
7 | |
8 | def ausgabe(): #Function for edition of strings on the console |
9 | print("Hello World!") |
10 | |
11 | knopf1 = Button(root, text="Menu", command=ausgabe) #Creation of |
12 | Button |
13 | knopf1.pack() |
14 | |
15 | ausgabe() # <- ? |
16 | mainloop() |
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.