Widget not showing up on screen

151 views
Skip to first unread message

Ayushman Singh

unread,
Jan 28, 2020, 9:24:30 AM1/28/20
to Kivy users support
I am a noobie at kivy and was trying to make a simple app with gridlayout and screens but for some reason 'myGrid:' is not showing up in the 'main' screen
Main COde.py
my.kv

Elliot Garbus

unread,
Jan 28, 2020, 12:11:52 PM1/28/20
to Kivy users support
Here are the changes:

Moved your ScreenManager to kv,  The name attribute is for the instance, not the class.  

Interesting 'feature'  The kv code would now work correctly with the names you gave the screens.  The python convention is to give classes CamelCaseNames.  I changed your screen names to CamelCase, ie from mainWIndow to MainWindow and things worked as expected.  I also removed most of the code from your python file, as it was not necessary.  Files attached.

see the bottom of the kv file:

BoxLayout:
ScreenManager:
MainWindow:
name: 'main'
SecondWindow:
name: 'second'
my.kv
Main COde.py

Elliot Garbus

unread,
Jan 28, 2020, 12:23:22 PM1/28/20
to Kivy users support
and... fixed the MyGrid...  files attached
Main COde.py
my.kv
Reply all
Reply to author
Forward
0 new messages