views:

61

answers:

2

Hello. I'm writing a small app which has 2 separate frames.

The first frame is like a video player controller. It has Play/Stop/Pause buttons etc. It's named controller.py.

The second frame contains OpenGL rendering and many things inside it, but everything is wrapped inside a Frame() class as the above. It's named model.py.

I'm up to the final part where I have to "join" these two together. Does anyone know how to control a frame (model.py) from another frame (controller.py)?

I would like to do something like a movie player when you clicks play it pops up a new window and play until the stop button is clicked.

If you know how, please let me know. (Just tell me in general no need to specific).

Thank you very much.

+2  A: 

Theres not much too it, you create an instance of your model class in your controller and call its methods. So for example when you click the models stop button its handler calls the appropriate method of your model class to stop playback.

If you would like your frames to be decoupled somewhat, you could use pubsub, and simply setup some listeners in your model for messages from your controller.

Here's a tutorial I just found on communciating between two frames using pubsub, it's not exactly what you want to do, but it should be enough to get you started in the right direction if you decide to use pubsub.

volting
A: 

I'd definitely use PubSub as it's probably the cleanest way I can think of to do it. You can also do it with wx.PostEvent or use a modal frame.

Mike Driscoll