|
From: Kevin A. <al...@se...> - 2001-12-31 07:08:14
|
I was playing around tonight and decided to try an experiment. I duplicated
the minimal directory and renamed it to 'multiwindow', then I copied the
doodle.py and doodle.rsrc.py sample files into the 'multiwindow' directory.
I added some imports to the minimal.py source file and an openBackground
handler to load the resource file for doodle and code to create another
background window. The source is below. Absolutely no changes were made to
the doodle files.
Get this, it worked the first time! The minimal window came up along with
the doodle window and all the events worked fine. Exiting is a problem
because the doodle window was not really a child of the minimal window, so
both windows have to be closed separately, but I know how to fix that. I
love being surprised.
There are a number of places where the Background class needs to be tweaked
and of course there are other issues, especially with the runtime debug
windows, but it looks very promising. So just imagine that any 'background'
can easily be used as part of your own program. Not a bad way to start the
new year.
We're more or less already doing this kind of thing with the GenericDialog
windows and it makes me think that perhaps it might be better if each
background resource was put in its own file. We also need to move the
menubar as an attribute of the background instead of the stack, but that's
another easy change.
I just want to say that Rowland Smith's original framework is still pretty
excellent kung fu! Kudos to Robin Dunn as well for wxPython and his other
contributions as well as everyone else on the mailing list that has helped
get PythonCard this far. This is so cool.
Happy New Year,
ka
---
from PythonCardPrototype import model, res
import doodle
class Minimal(model.Background):
def on_openBackground(self, target, event):
rsrc = res.ResourceFile('doodle.rsrc.py').getResource()
self.doodleWindow = doodle.Doodle(self.stack,
-1,
rsrc,
rsrc.stack.backgrounds[0])
self.doodleWindow.Show()
def on_menuFileExit_select(self, menu, event):
self.Close()
if __name__ == '__main__':
app = model.PythonCardApp(Minimal)
app.MainLoop()
|