Search code examples
pythonkivykivy-language

How make a button apear out of app's window any where in the screen?


My app Image I want to make any number of Buttons out side of this app's main window in screen above all applications.
Button display should be main priority than any other app's window.

This should be like this what should I do please help. Output

Here, Is my simple python code:-

#main.py
from kivy.app import App
from kivy.uix.widget import Widget

class MainWidget(Widget):
    pass

class BLApp(App):
    pass

BLApp().run()

Here, Is my simple kivy code:-

#BL.kv
MainWidget:

<MainWidget>:

    Button:
        text: "Hello World"
        size: "100dp","100dp"
        pos: "100dp","100dp"

Solution

  • I got a nice answer from Support Channels: https://groups.google.com/group/kivy-users

    That is I am sharing here

    Multiprocessing alone will not solve your problem. Kivy widgets are restricted to drawing in the Window.

    Here are some other options that you could consider:

    1)Create a small Borderless Window. If the single widget app is standalone, all you need to do is create a Window the size of the widget, and use Borderless mode. Look for the borderless object in the Config options to create a borderless Window. https://kivy.org/doc/stable/api-kivy.config.html#module-kivy.config

    2)Look at using a transparent window: There is an example of a shaped Window in the examples directory, you could create a transparent Window that shows the background, but overlays widgets. In your installation directory See: \share\kivy-examples\miscellaneous\shapedwindow.py

    3)Create multiple programs that work together… just a thought but create an app that uses a borderless Window, and is the size of the desired widget, you could place this anywhere in the window. If you need to communicate with other programs use sockets, or you could use multiprocessing and shared variables.