Random, un-killable panda window when working in Eclipse

I’m working with wxWidgets and Panda in Ubuntu, and my IDE is Eclipse. Occasionally an unkillable, blank (not grey) panda window pops up. It happens whether or not I click on anything, but it only ever happens when I have a file open that contains my wxWidget and panda code.

Is Eclipse triggering something when trying to parse my code for code completion (pylint for example?) or something?

Has anyone seen this before. It’s not a big deal, just mildly annoying.

sorry, i have not experience this before…

Same setup but I also never experienced this before.

I bet your importing direct.directbase.DirectStart, right? Eclipse probably imports that, and as a consequence, it opens a Panda window.

Yet another reason to refactor the entire direct library…

Yep, that was it. I commented out that import, and it no longer opens the window on load. Is there a better import I should use, or perhaps a way to tell pydev not to execute it?

FYI, I got the window to stop appearing by removing the direct object references and using showbase instead.

This is a little late on my part (got delayed by getting tangled in threads :slight_smile: ), but ShowBase is intended for production code, while DirectStart is more for demos and prototyping.

That’s exactly what I was wondering, but I couldn’t find anywhere which option is “proper”, and I’ve seen code samples with both.

Good to know,
thanks,

Actually, that’s not true. DirectStart simply imports and instantiates ShowBase. You can use either, but we started encouraging use of ShowBase because many people find it counter-intuitive that a module import would actually open a window.

Frankly, I would recommend removing (or at least deprecating) DirectStart, for many reasons:

  • It’s extremely unPythonic. While this is somewhat subjective, it is at least at odds with the famous Zen of Python:
    [list]
    [*]“Explicit is better than implicit.” DirectStart blatantly breaks this rule, by implicitly initializing a ShowBase instance when imported. Most people expect initialization to be handled by some function, not by the act of mere importation.
  • “Readability counts.” If a newbie who had no experience with Panda3D read a program that used DirectStart, don’t you think he would wonder “where in the world are these base and loader variables being defined??”
  • “There should be one – and preferably only one – obvious way to do it.” ShowBase is just as simple as DirectStart, and it’s much more Pythonic. Why should DirectStart exist, then?
    [/:m]
    [
    ]It is rarely used, save for some example applications. I could be wrong on this, but I know for sure it saves just a few lines of code, at the cost of readability.[/:m]
    [
    ]As we’ve seen in this thread, many IDE’s syntax highlighters/validators choke on DirectStart, as they assume (and rightfully so) that all imported Python modules will not be initialized just by being imported.[/*:m][/list:u]

I agree, this is why we don’t encourage using it. But it’s still used by a large portion of users, and removing it would seriously break backward compatibility. That’s why it’s still there, but not recommended to use.