I might be wrong, but instantiating an unnamed *class variable* doesn't sound
like standard usage to me. Even if you gave that class variable a name (e.g.
"w = Widget()"), having a widget in a class variable sounds like something is
wrong. Surely widgets should (almost?) always be instance variables, in which
case they shouldn't be created (and a window shouldn't appear) unless you make
an instance of your class. Are you forgetting a "def __init__(self):" to define
the class constructor before instantiating a widget in that?
Peace,
Brendon
On July 24, 2014 13:03:49 Damien Frikha wrote:
> Yeah, you basically summed up what I came to understand from these tests.
> But, since I didn't instantiate the "MyWidget" class in my code (it's just
> a class definition), the Widget() call shouldn't be made too, should it?
> Meaning that the core window stuff shouldn't be added, thus creating the
> window?
>
> The problem is that it did, so I don't see how I could spawn a new process
> from the main code without opening a new window, since whatever I do there
> will always be somewhere in a class definiton where I instantiate a kivy
> class.
>
> Le jeudi 24 juillet 2014 11:16:22 UTC-7, ZenCODE a écrit :
> > From what you say, it seems like you can just avoid creating any uix
> > widgets? They probably import the core window which creates the window you
> > see. Let's look.
> >
> > from kivy.uix.widget import Widget
> >
> > class MyWidget(Widget):
> > pass
> >
> > Yes, that does not open a window because nowhere is a widget created, just
> > defined. Hence no window.
> >
> > from kivy.uix.widget import Widget
> >
> > class MyWidget(Widget):
> > Widget()
> >
> > Okay, now you are creating a widget, thus the Window. The brackets create
> > instances if they follow a class name.
> >
> > *"It's not even related with the App or Window class since I don't even
> > import them in the project."*
> >
> > Widgets are visual and part of the kivy uix, and thus relate to and import
> > core window stuff.
> >
> > *"Launching widget.py (from the libraries) does not open a window
> > either."*