Files
E-To-Amelie-hasenspiel/meinspiel.py
T
2026-09-30 11:02:12 +02:00

60 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import copy
import pygame
class MeinSpiel:
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):
for x in range(felderX):
self.spielfeld.append([])
for y in range(felderY):
self.spielfeld[x].append(0)
def anfangsKonfiguration(self):
self.spielfeld[5][5] = 0
for y in range(12):
if y %3:
for x in range(12):
if x %3:
self.spielfeld[x][y]=1
def tasteGedrueckt(self, taste):
print("taste gedrückt")
# Von 0 bis 10 in Schritten von 2
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()