Browse Source

fix: SDL new event.type mouse.press/release

micha 6 months ago
parent
commit
a36d4647f4
2 changed files with 6 additions and 5 deletions
  1. 2 2
      tksdl/fix.py
  2. 4 3
      tool/sdl_elm.py

+ 2 - 2
tksdl/fix.py

@@ -739,8 +739,8 @@ while 1:
             event = {'unicode': '', 'key': 0, 'mod': 0, 'scancode': 0, 'window': None,'type':'','button':''}
             event['type'] = raw_event.type
             event.update( raw_event.dict)
-            if event['button'] and event["type"] in [pygame.MOUSEBUTTONDOWN,pygame.MOUSEBUTTONUP]:
-                event["type"] -= 1020
+            #if event['button'] and event["type"] in [pygame.MOUSEBUTTONDOWN,pygame.MOUSEBUTTONUP]:
+            #    event["type"] -= 1020
 
             if event["button"] or event['scancode']:
                 print(" event:",event)

+ 4 - 3
tool/sdl_elm.py

@@ -464,13 +464,14 @@ class Button():
 
             if "button" in event.dict:
                 mode = ""
-                if event.type in [5,1025]:
+                if event.type in [5,pygame.MOUSEBUTTONDOWN]:
                     mode = "press"
-                if event.type in [6,1026]: 
+                if event.type in [6,pygame.MOUSEBUTTONUP]: 
                     mode = "release"
-
+                
                 e = [event.button,mode]
                 #print("e",e)
+                #print()
                 for btn in self.btns: 
                     if e[0] in btn.nr_on  and e[1] == "press":
                         btn.press()