Sample Framework Hanging on Escape


01-12-2005 03:03:35

Hello all,

First off, thanks for the wonderful product. I'm amazed that I got up and running so quickly.

Secondly, any idea why the window refuses to close when I press the Escape key? All other activity stops, but the window isn't closed and the screen resolution isn't restored to its previous state.

Thanks much,


01-12-2005 03:05:45

By the way, I should mention that I'm running through the sample program given here -- ... Tutorial_1

It currently looks like this --

from pyogre import ogre
import SampleFramework

class TutorialApplication(SampleFramework.Application):
def _createScene(self):
sceneManager = self.sceneManager
sceneManager.ambientLight = ogre.ColourValue(1, 1, 1)
ent1 = sceneManager.createEntity("Robot", "robot.mesh")
node1 = sceneManager.rootSceneNode.createChildSceneNode("RobotNode")

if __name__ == '__main__':
ta = TutorialApplication()


01-12-2005 03:25:23

Hmm. Odd. The problem just disappeared after working a bit further into the article --

def _createScene(self):
sceneManager = self.sceneManager
sceneManager.ambientLight = (1, 1, 1)

ent = sceneManager.createEntity("Robot", "robot.mesh")
node = sceneManager.rootSceneNode.createChildSceneNode("RobotNode")
node.scale = (.5, 1, 2)

ent = sceneManager.createEntity("Robot2", "robot.mesh")
node = sceneManager.rootSceneNode.createChildSceneNode("RobotNode2", (50, 0, 0))
node.scale = (0.5, 0.2, 1)
node.scaleBy(2, 10, 1)


01-12-2005 03:35:35

This is a problem that happens with some python editors. If you launch it from within Idle the window will stay open. (I think I've seen it in SPE as well.) Currently the best way to fix it is to either run in windowed mode (so you can kill the window manually, or to not launch it from Idle.

I made a lot of assumptions here. You are running this from an IDE right? And you are probably running under windows?

Edit: If it works now I'm not sure. Generally you should be careful when running from an IDE. Let me know if you narrow the problem down.


01-12-2005 04:37:34

Welp, your experience shows -- I'm launching in Idle on Windows 2000.

I've switched over to good old notepad + windows explorer for the time being and it seems to be working fine.

However, I've bumped into a problem with the fog now. I'll post it in a new thread, though. :)

Thanks again,


01-12-2005 05:35:20

I personally use SPE to edit (though I used Idle too), and I just launch the program from windows explorer (IE double clicking the file) and it works great. But I also add code to the exception handling area which dumps the error to a file so if something doesn't work I have a nice "errors.txt" to read. I wish I knew what caused the problems, but even in C++ world Ogre doesn't like being restarted.


01-12-2005 16:34:58

On the topic of IDEs, we used Eclipse with the PyDev plugin when working on A Violent World (check the projects thread). Worked really nice, although there might be more features in SPE I guess. Started it up a couple of times but didn't really like it then.

Eclipse also has an SVN plugin, which is quite nice as well. Also, we didn't have any problems with starting the game from within it. Especially after Ecplise and PyDev was updated and I reinstalled it from scratch.

Just a tip. :)

What do you like about SPE, Clay? I'm on the lookout for a good Python editor. Eclipse is really too heavy to use for small scripts, and ConTEXT have been starting to act weird.


01-12-2005 17:03:25

There are three features I use spe for:
  1. Tabbed windows for editing, and a built-in console at bottom of the window. I dislike developing in Idle because it leaves 400 windows open.[/*:m]
  2. PyChecker built in. PyChecker won't fix everything for you, but when it thinks something is wrong, usually you need to fix it.[/*:m]
  3. Minor features like it's mini-initellisense, wx editor, and saving your workspace for the next time you load up. Not things that are critical for me to have, but nice features anyway.[/*:m][/list:u]
    Personally I like my editors to either be extrodinarily light weight (doing only syntax highlighting and tabbed browsing). Which is why I use a copy of TextPad I purchased for most of my lightweight development because it does exactly that.

    When I'm working on a big project I like to have something similar to Visual Studios. You can say whatever you want about "microsoft bad, linux good", and I'm right there with you...until it comes to Visual Studios. Nothing in linux world can compete with the VS IDE and the VS debugger. The only tool which I would love under windows that only exists for linux is valgrind, but with VS 2005 Professional they are including a profiler.

    Anyway, I really ranted off topic. The point is, I'd love to see something like VS for large Python projects. SPE is a very small step in that direction, and I hope they get a little farther along with it.

    Really I think SPE is just a "best fit" to my development style for Python, and that's why I perfer it.


02-12-2005 04:01:18

Hey Srekel,

Thanks for the tip.

Got a question for you --

What did you use to create the executable and the setup program?

I'm assuming py2exe for the former?



02-12-2005 08:24:35

Yeah, py2exe. Check out the guide I wrote, might be of interest: ... ctorySetup

I think we used NSIS, but I'm not sure. It was an open source installer.


02-12-2005 11:56:27

Yeah, py2exe. Check out the guide I wrote, might be of interest: ... ctorySetup

I think we used NSIS, but I'm not sure. It was an open source installer.

Yes, we used NSIS together with HM NIS Edit.


02-12-2005 16:52:37

One thing I noticed with SPE - if you get an exception in OGRE, SPE just disappears. Not sure if this is with uncaught exceptions or not.