How to make a kivy file in pycharm

505 views
Skip to first unread message

Noxx

unread,
Aug 15, 2022, 6:22:28 AM8/15/22
to Kivy users support
hey, as it says in the title, i cant figure out how to create a kivy file in pycharm.

Elliot Garbus

unread,
Aug 15, 2022, 8:47:42 AM8/15/22
to kivy-...@googlegroups.com

Select file/new/file and type the filename with extension… my.kv

Or you can right click on the project name and select new…/file  and type the file name with extension.

 

If you would like syntax highlighting for your kv file see: https://github.com/kivy/kivy/wiki/Setting-Up-Kivy-with-various-popular-IDE's

--
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/86574436-1bdd-441f-82da-95d41341f49dn%40googlegroups.com.

 

Noah

unread,
Aug 15, 2022, 10:04:32 AM8/15/22
to kivy-...@googlegroups.com
 
funky button.py    :
 
 
from kivy.app import App
from kivy.uix.button import Button

class FunkyButton(Button):
   
def __init__(self, **kwargs):
       
super(FunkyButton, self).__init__(**kwargs)
       
self.text = "Funky Button"
       
self.pos = (100,100)
       
self.size_hint = (.25,.25)

class LanguageLearnerApp(App):    #parent
   
def build(self):
       
return FunkyButton()


if __name__ == "__main__":
    LanguageLearnerApp().run()
 
 
funky button.kv    :
 
 
#:kivy 2.1.0

<FunkyButton>:
    canvas:
        Rectangle:
            pos: 50, 50
            size: 100, 100
 
 
 
 
Yeah but it gives me following error if i try and run funky button.kv

The file in the Editor is not runnable

 

 

 

Gesendet von Mail für Windows

Elliot Garbus

unread,
Aug 15, 2022, 10:13:15 AM8/15/22
to kivy-...@googlegroups.com

You don’t run the kv file, you run the python file.

You are not loading the kv file.  You can name the kv file “LanguageLearner.kv“  and it will automatically be loaded, or use the builder module to load the kv file or kv string.

See: https://kivy.org/doc/stable/api-kivy.app.html?highlight=app#kivy.app.App.load_kv

And: https://kivy.org/doc/stable/api-kivy.lang.html?highlight=lang#module-kivy.lang

Noah

unread,
Aug 15, 2022, 10:15:22 AM8/15/22
to kivy-...@googlegroups.com

Oh i finally got it thank you so much!!!

Reply all
Reply to author
Forward
0 new messages