Call functions from another classes

19 views
Skip to first unread message

Julio CamPlaz

unread,
Jun 24, 2015, 7:11:31 AM6/24/15
to kivy-...@googlegroups.com

Hello,
I´m making a little example and there is a thing I do not undestand. I created a TabPannel with 3 initial tabs, and I created two botons which add a new tab when you press them. The second one adds the tab directly and it works perfectly.The first one opens a Popup in order to be able to put the name to the new tab, however, the button "OK" (inside the Popup widget does not work).

I created two classes: the MainWindow class, and the Popup class.

The question is: HOW CAN I CALL A MAINWINDOW CLASS FUNCTION FROM THE POPUP CLASS???

 If I do..

on_press: MainWindow().shown()  ----> it raises this error: NameError: name 'MainWindow' is not defined.

I have done it from several ways and I does not work...

How can I do it?? Thanks you!!

I show the code in the following picture:

Alexander Taylor

unread,
Jun 24, 2015, 7:54:23 AM6/24/15
to kivy-...@googlegroups.com
If a MainWindow instance is the root widget, use app.root.shown(). You can't do root.shown() because root refers to the root of the kv rule, not the root of the whole application.
Reply all
Reply to author
Forward
0 new messages