How to properly name Kivy window

761 views
Skip to first unread message

marongi...@gmail.com

unread,
Feb 7, 2021, 3:57:21 PM2/7/21
to Kivy users support
Hello,
I am generating a window using Kivy but its name is "Unnamed window". I tried to give it a name with:
```
class MyApp(App):
    # load kivy file
    def build(self):
        return Builder.load_file("./kivyFile.kv")
        Window.set_title("My Window")
``` 
But it did not work. What is the right way to name a window?
Thank you

Pranav Balaji Pooruli

unread,
Feb 7, 2021, 4:05:48 PM2/7/21
to kivy-...@googlegroups.com
Try

class MyApp(App):
 title = 'My Window'
 def build(self):
  return ...

This works for me every time.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/07bb8ecf-62fc-4dd9-bdf0-2d886c57e603n%40googlegroups.com.

Elliot Garbus

unread,
Feb 7, 2021, 4:17:35 PM2/7/21
to kivy-...@googlegroups.com

The is not working because you are returning prior to executing the Window.set_title() code.

 

class MyApp(App):

    # load kivy file

    def build(self):

        return Builder.load_file("./kivyFile.kv")

        Window.set_title("My Window")

 

In app you can  simply use self.title to set the title

 

def build(self):

        self.title = ‘My Window’

        return Builder.load_file("./kivyFile.kv")

 

read: https://kivy.org/doc/stable/api-kivy.app.html#kivy.app.App.title

--

Luigi Marongiu

unread,
Feb 9, 2021, 5:54:24 AM2/9/21
to Kivy users support
thank you
> To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/602058eb.1c69fb81.e3d52.5d9cSMTPIN_ADDED_MISSING%40gmr-mx.google.com.



--
Best regards,
Luigi
Reply all
Reply to author
Forward
0 new messages