RIF: [wxPython-users] Event handling between two frame!
Raffaello Barella
barbarossa.platz at gmail.com
Thu Aug 30 09:15:39 PDT 2007
First, if you speak Italian and this conversation is going to continue,
please let me know: it will be better for both of us.
I forgot to tell you that, if you want to call a function from a different
module, you need import beforehand that module. Supposing that the class
main_frame is in the file flMain_Frame.py, write at the beginning of the
file containing the class second_frame the following line:
import flMain_Frame as M # (the alias M is not indispensable, but it helps)
Then, for calling DoSomething from second_frame, write:
M.main_frame.DoSomething()
Please let me know if this solves your problem. Bye
2007/8/30, Giuseppe Costanzi <G.Costanzi at idi.it>:
>
>
>
> Thanks for your interest but,
> your script work only if you put
> def DoSomething(self):
> print 1
> out of the main_frame class.
> So if you call the DoSomething function from another frame
> main_frame.DoSomething()
> you see on shell print 1.
> But ,even in this case, I don't succed to call a def into the frame class.
> If I try like you have write I got the follow exception
>
> Traceback (most recent call last):
> File "C:\Python\testingstuff\test\SecondFrame.py", line 138, in OnTest
> main_frame.DoSomething(self)
> AttributeError: 'module' object has no attribute 'DoSomething'
>
> My problem is that I don't succed to call a function that is in a
> frame class from another frame.
> What I haven't understand?
>
> gretting
>
>
>
> -----Messaggio originale-----
> Da: Raffaello Barella [mailto:barbarossa.platz at gmail.com]
> Inviato: gio 30/08/2007 13.41
> A: wxPython-users at lists.wxwidgets.org
> Cc:
> Oggetto: Re: [wxPython-users] Event handling between two frame!
>
> My solution is to separate the handling of the event from the actual
> action,
> e.g. I write this code in the main_frame:
> def On_EVT_LIST_ITEM_SELECTED(self, event):
> self.DoSomething()
> event.Skip()
> def DoSomething(self):
> print 1
>
> In the second frame, you simply call the function DoSomething() thus:
> main_frame.DoSomething()
> and if will print 1.
>
> I admit it is rather rude, but it works. Bye
>
>
>
>
> ---------------------------------------------------
> Ai sensi della Legge 196/03 si precisa che le informazioni contenute in
> questo messaggio sono riservate ed a uso esclusivo del destinatario. Qual=
ora
> il messaggio Le fosse pervenuto per errore, la preghiamo di eliminarlo se=
nza
> copiarlo e di non inoltrarlo a terzi, dandocene gentilmente comunicazione.
> Grazie.
>
> This message, for the law 196/03, may contain confidential and/or
> privileged information. If you are not the addressee you must not use,
> copy, disclose or take any action based on this message or any information
> herein. If you have received this message in error, please advise the sen=
der
> immediately and delete this message. Thank you for your cooperation
>
> E' nata IDICard, la carta prepagata ricaricabile sicura e flessibile,
> che ti offre agevolazioni e sostiene la ricerca scientifica ed i progetti
> umanitari dell'IDI Sanita'
> ---------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200708=
30/d00aae67/attachment.htm
More information about the wxpython-users
mailing list