8
0

Anlage des Repos

This commit is contained in:
2024-01-24 16:42:38 +01:00
commit 38d6a271c4
1785 changed files with 3051496 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Python program to determine which
# button was pressed in tkinter
# Import the library tkinter
import tkinter
from tkinter import *
# Create a GUI app
app = Tk()
# Create a function with one paramter, i.e., of
# the text you want to show when button is clicked
def which_button(button_press):
# Printing the text when a button is clicked
print(button_press)
label1 = tkinter.Label(font=('Arial', 12), bg="green", fg="black",text=" ")
label1.grid(row=1, column=2)
def key(event):
app.event_generate('<Motion>', warp=True, x=50, y=50)
def motion(event):
print('motion {}, {}'.format(event.x, event.y))
# Creating and displaying of button b1
b1 = Button(app, text="Apple", activebackground='blue', activeforeground='yellow', command=key(): which_button(m), bg="green", fg="black")
b1.grid(row=0, column=1, padx=10, pady=10)
# Creating and displaying of button b2
b2 = Button(app, text="Banana",
command=lambda m="It is a banana": which_button(m))
b2.grid(row=0, column=2, padx=10, pady=10)
# Make the infinite loop for displaying the app
app.mainloop()