Browse Source

fix: pygame.MOUSExx fix:install pip --break-system-packages

micha 6 months ago
parent
commit
c916f87876
3 changed files with 31 additions and 18 deletions
  1. 21 12
      install.sh
  2. 8 4
      tksdl/fix.py
  3. 2 2
      tksdl/start.py

+ 21 - 12
install.sh

@@ -38,29 +38,38 @@ pkg="python3-opengl python3-pyglet python3-pil "
 apt install -y $pkg 
 #exit
 
+OPTION=""
+I=$(lsb_release -r | cut -f 2);
+echo $I
+if [ "x$I"=="x12" ]; then
+    OPTION="--break-system-packages"
+    echo "OK $OPTION"
+fi
 
 echo ""
 echo "-- update pip"
 su -- user <<EOF
 id
-pip install pip --upgrade --break-system-packages
+pip install pip --upgrade $OPTION
 EOF
 
+
+
 echo ""
 echo "-- python-pip pkg's"
 su -- user <<EOF
-pip install pyopengltk --break-system-packages
-pip install moderngl --break-system-packages
-pip install moderngl-window --break-system-packages
+pip install pyopengltk $OPTION
+pip install moderngl $OPTION
+pip install moderngl-window $OPTION
 echo ""
-pip install glfw --break-system-packages
-pip install glwindow --break-system-packages
-pip install glnext --break-system-packages
-#pip install glnext_compiler --break-system-packages
-pip install glcontext --break-system-packages
-pip install pyopengltk --break-system-packages
-pip install imutils --break-system-packages
-pip install raylib --break-system-packages
+pip install glfw $OPTION
+pip install glwindow $OPTION
+pip install glnext $OPTION
+#pip install glnext_compiler $OPTION
+pip install glcontext $OPTION
+pip install pyopengltk $OPTION
+pip install imutils $OPTION
+pip install raylib $OPTION
 EOF
 
 echo ""

+ 8 - 4
tksdl/fix.py

@@ -396,6 +396,10 @@ while 1:
         
         #window.fill((2,2,2))
         window.fill((0,0,0))
+
+        fr = font15.render("FPS:"+str(fps_old) ,1, rgb) #(200,200,200))
+        window.blit(fr,(600,5))
+
         pygame.draw.rect(window,(0,0,0),[0,0,main_size[0],main_size[1]])
         
 
@@ -735,7 +739,7 @@ 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 [1025,1026]:
+            if event['button'] and event["type"] in [pygame.MOUSEBUTTONDOWN,pygame.MOUSEBUTTONUP]:
                 event["type"] -= 1020
 
             if event["button"] or event['scancode']:
@@ -935,10 +939,10 @@ while 1:
 
             if "pos" in event:
                 if "button" in event:
-                    if event['type'] in [5,1025]:#press
+                    if event['type'] in [5,pygame.MOUSEBUTTONDOWN]:#press
                         mouse_down = 1
                         mouse_pos1 = [event['pos'][0],event['pos'][1]]
-                    if event['type'] in [6,1026]:#release
+                    if event['type'] in [6,pygame.MOUSEBUTTONUP]:#release
                         mouse_down = 0
 
                 mouse_pos2 = [event['pos'][0],event['pos'][1]]
@@ -949,7 +953,7 @@ while 1:
                 pass
 
             elif "button" in event:
-                if event['type'] in [6,1026]:
+                if event['type'] in [6,pygame.MOUSEBUTTONUP]:
                     if event["button"] == 1:
                         mouse_grab_active = 0
                         for mg in mouse_grab:

+ 2 - 2
tksdl/start.py

@@ -204,10 +204,10 @@ while run:
 
         if "pos" in event.dict:
             if "button" in event.dict:
-                if event.type in [5,1025]:#press
+                if event.type in [5,pygame.MOUSEBUTTONDOWN]:#press
                     mouse_down = 1
                     mouse_pos1 = [event.pos[0],event.pos[1]]
-                if event.type in [6,1026]:#release
+                if event.type in [6,pygame.MOUSEBUTTONUP]:#release
                     mouse_down = 0
 
                 for btn in mouse_grab: