a
This commit is contained in:
+31
-2
@@ -2,7 +2,7 @@ import copy
|
||||
import pygame
|
||||
|
||||
class MeinSpiel:
|
||||
bilder = ["Bilder/Schach.jpg","Bilder/stern.jpg","Bilder/motiv1.jpg","Bilder/motiv2.jpg","Bilder/motiv3.jpg","Bilder/motiv4.jpg","Bilder/motiv5.jpg","Bilder/motiv6.jpg","Bilder/motiv7.jpg","Bilder/motiv8.jpg"]
|
||||
bilder = ["Bilder/Schach.jpg","Bilder/stern.jpg","Bilder/motiv1.png","Bilder/motiv2.png","Bilder/motiv3.png","Bilder/motiv4.png","Bilder/motiv5.png","Bilder/motiv6.png","Bilder/motiv7.png","Bilder/motiv8.png"]
|
||||
spielfeld = []
|
||||
|
||||
def __init__(self, felderX, felderY):
|
||||
@@ -28,4 +28,33 @@ class MeinSpiel:
|
||||
for i in range(0, 11, 5):
|
||||
print(i)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
from pynput import mouse
|
||||
|
||||
# Callback-Funktion bei Mausklick
|
||||
def on_click(x, y, button, pressed):
|
||||
if pressed:
|
||||
print(f"Mausklick gedrückt bei Position ({x}, {y}) mit Taste {button}")
|
||||
else:
|
||||
print(f"Mausklick losgelassen bei Position ({x}, {y}) mit Taste {button}")
|
||||
|
||||
# Callback-Funktion bei Mausbewegung
|
||||
def on_move(x, y):
|
||||
print(f"Maus bewegt zu Position ({x}, {y})")
|
||||
|
||||
# Callback-Funktion beim Mausrad-Scrollen
|
||||
def on_scroll(x, y, dx, dy):
|
||||
print(f"Mausrad bewegt bei Position ({x}, {y}) – Delta: ({dx}, {dy})")
|
||||
|
||||
# Listener starten
|
||||
with mouse.Listener(
|
||||
on_click=on_click,
|
||||
on_move=on_move,
|
||||
on_scroll=on_scroll
|
||||
) as listener:
|
||||
print("Maus-Event-Listener gestartet. Beenden mit STRG+C.")
|
||||
listener.join()
|
||||
Reference in New Issue
Block a user