wxPtyhon 2.4 non trivial problems :D

Michal Raburski zordax at wp.pl
Fri Mar 11 09:49:08 EST 2005


Hi to everybody :)

I use Boa-constructor 0.3.1, wx 2.4 and python 2.3.

I'have 2 big problems in my application :

1. My EVT_KEY_UP on wxTextCtrl works only when mouse pointer is on the
active window. If i'll move it outside the window (with no clicking)
it doesn't work. And if i move mouse pointer back on the window - it
works.

Anyone know why???

2. My application is divided into few sections. I want to create each
window only once - on first visit, because creating a window takes a
80% of time needed to open it (about 6 seconds on a middle-sized
window). I did a construction which allows to do this and which
destroys all windows on exiting to another section of program. Here is
my solution :

from wxPython.wx import *
from wxPython.lib.maskededit import *
from wxPython.lib.maskednumctrl import *
...

window = None      // variable which has a object inside (its not
destroyed
                      after a closing a window
oldparent = None   // it helps me to check do i have to recreate a
window with
                      new parent

def ShowMyWindow(parent):         //this function shows my window. And
creates
                                    it if needed
    global window,oldparent

    if oldparent<>parent:
        oldparent = parent
        window = create(parent)
            
    window.Inicialize(parent)    // it does some things to window -
sets
                                    accelerator table, sets
fonts,loads data and
                                    such
    window.SetTitle(' My window')
    window.MakeModal(True)
    window.Show()
 

And i close my window with :

    def OnMyWindowClose(self, event):
        self.Hide()
        self.MakeModal(FALSE)


It's destroyed when a parent is destroyed.

It looks simple. 

Now my problem  :D 

I can create a chains of windows. They are all destroyed when the
parent of the first of them is being destroyed.

I want to create tree :

               Parent
                  |
               Child1
                  |
               Child2

Where parent is created and destroyed on open/close and children are
created once and destroyed with parent.

When i open a child1 and close it - it stays created, and if i open it
second time it opens faster and works properly. It happens with second
child too. Problem appears when i : open first child, open second
child and close both. Then they both exist and child1 is parent of
child2. After that if i open child1 it works properly, but opening of
child2 results with some kind of inactivity of it. It's losing focus
on all application and is inactive in strange way. My tests told me
that both windows exist.

Can anyone can help me? It's really important to me...

Thanks for answers

Michal



More information about the Python-list mailing list