community icon indicating copy to clipboard operation
community copied to clipboard

Window.set_custom_titlebar not working

Open ARahmanKhallaf opened this issue 3 years ago • 1 comments

Software Versions

  • Python: 3.9.1
  • OS: Windows 10
  • Kivy: 2.1.0
  • Kivy installation method: pip

Describe the bug when I use "Window.set_custom_titlebar" I get that error.

Expected behavior move the window when dragging my title bar.

Code and Logs and screenshots

code:
main.py:

from kivy.core.window import Window
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget

class MainLayout(Widget):
    pass

# titel bar
class Titel_bar(Widget):
    pass

# main window
class Main_window(BoxLayout):
    pass

Window.size = (760, 440)
Window.custom_titlebar = True
Window.set_custom_titlebar(Titel_bar)


class loginFormApp(App):
    pass

loginFormApp().run()

------------------------------------------------------------------------------
loginFormApp.kv:

MainLayout:

<MainLayout>:
    # titel bar
    Main_window:
        size: 760, 400
    # titel bar
    Titel_bar:
        size: 760, 40
        pos: 0, 400

<Titel_bar>:
    # size
    size_hint: None, None
    size: 760, 40
    draggable: True
    # color
    canvas.before:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size

<Main_window>:
    # size
    size_hint: None, None
    size: 760, 400
    
    # color
    canvas.before:
        Color:
            rgba: 0, 0, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size

Logs:
[←[1;32mINFO←[0m   ] [Logger      ] Record log in C:\Users\A.Rahman Khallaf\.kivy\logs\kivy_22-08-04_46.txt
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.2
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.1
[←[1;32mINFO←[0m   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.4.5
[←[1;32mINFO←[0m   ] [Kivy        ] v2.1.0
[←[1;32mINFO←[0m   ] [Kivy        ] Installed at "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
[←[1;32mINFO←[0m   ] [Python      ] v3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
[←[1;32mINFO←[0m   ] [Python      ] Interpreter at "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\python.exe"
[←[1;32mINFO←[0m   ] [Logger      ] Purge log fired. Processing...
[←[1;32mINFO←[0m   ] [Logger      ] Purge finished!
[←[1;32mINFO←[0m   ] [Factory     ] 189 symbols loaded
[←[1;32mINFO←[0m   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[←[1;32mINFO←[0m   ] [Window      ] Provider: sdl2
[←[1;32mINFO←[0m   ] [GL          ] Using the "OpenGL" graphics system
[←[1;32mINFO←[0m   ] [GL          ] GLEW initialization succeeded
[←[1;32mINFO←[0m   ] [GL          ] Backend used <glew>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL version <b'4.6.0 - Build 27.20.100.9664'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL vendor <b'Intel'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[←[1;32mINFO←[0m   ] [GL          ] OpenGL parsed version: 4, 6
[←[1;32mINFO←[0m   ] [GL          ] Shading version <b'4.60 - Build 27.20.100.9664'>
[←[1;32mINFO←[0m   ] [GL          ] Texture max size <16384>
[←[1;32mINFO←[0m   ] [GL          ] Texture max units <32>
[←[1;32mINFO←[0m   ] [Window      ] auto add sdl2 input provider
[←[1;32mINFO←[0m   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[←[1;32mINFO←[0m   ] [Base        ] Start application main loop
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'
 TypeError: collide_point() missing 1 required positional argument: 'y'
 Exception ignored in: 'kivy.core.window._window_sdl2.custom_titlebar_handler_callback'
 Traceback (most recent call last):
   File "C:\Users\A.Rahman Khallaf\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\window\window_sdl2.py", line 985, in _wnd_proc
     return windll.user32.CallWindowProcW(
 TypeError: collide_point() missing 1 required positional argument: 'y'

Additional context Add any other context about the problem here. sec

ARahmanKhallaf avatar Aug 04 '22 15:08 ARahmanKhallaf

This is not an kivy issue. In the ~kivy.core.window.__init__.py inside the function set_custom_titlebar is soem usefully info what was helped you to solve it.

This is from set_custom_titlebar documentation.

        The function is call with two args x,y which are mouse.x, and mouse.y
        the function should return

        | `True` if that point should be used to drag the window
        | `False` if you want to receive the touch event at the point

kmcasi avatar Aug 12 '22 16:08 kmcasi