Open a frame

hi,
because I'm tired of always typing the same lines of code
to open a frame like

def OnOpenTransactions(self,event):

        obj = dlg_transactions.dlgTransactions(parent = self)

        obj.OnOpen()
        obj.Show()
        obj.Center()

I thought about doing this

def OnOpenTransactions(self,event):

        obj = dlg_transactions.dlgTransactions(parent = self)
        self.OnShow(obj)

def OnShow(self,object):

        try:
            object.OnOpen()
            object.Show()
            object.Center()
        except:
            print sys.exc_info()[0],
            print sys.exc_info()[1],
            print sys.exc_info()[2],

but nothing happens, even as an exception
suggestions?

Have you tried tracing through the execution of the code with a debugger so you can see exactly what is happening and what is being called?

···

On 3/14/12 9:39 AM, beppe wrote:

hi,
because I'm tired of always typing the same lines of code
to open a frame like

def OnOpenTransactions(self,event):

         obj = dlg_transactions.dlgTransactions(parent = self)

         obj.OnOpen()
         obj.Show()
         obj.Center()

  I thought about doing this

def OnOpenTransactions(self,event):

         obj = dlg_transactions.dlgTransactions(parent = self)
         self.OnShow(obj)

  def OnShow(self,object):

         try:
             object.OnOpen()
             object.Show()
             object.Center()
         except:
             print sys.exc_info()[0],
             print sys.exc_info()[1],
             print sys.exc_info()[2],

but nothing happens, even as an exception
suggestions?

--
Robin Dunn
Software Craftsman

> hi,
> because I'm tired of always typing the same lines of code
> to open a frame like

> def OnOpenTransactions(self,event):

> obj = dlg_transactions.dlgTransactions(parent = self)

> obj.OnOpen()
> obj.Show()
> obj.Center()

> I thought about doing this

> def OnOpenTransactions(self,event):

> obj = dlg_transactions.dlgTransactions(parent = self)
> self.OnShow(obj)

> def OnShow(self,object):

> try:
> object.OnOpen()
> object.Show()
> object.Center()
> except:
> print sys.exc_info()[0],
> print sys.exc_info()[1],
> print sys.exc_info()[2],

> but nothing happens, even as an exception
> suggestions?

Have you tried tracing through the execution of the code with a debugger
so you can see exactly what is happening and what is being called?

ops..my mistake,
using a class method to control the instances of objects's
application have mistaken between true and false return value
in fact when I open a frame or a dialog I assign its instances to a
dictionary in a class visible to all the application

obj = dlg_transactions.dlgTransactions(parent = self)
self.dict_instances['dlg_transactions']= obj

and when I try to reopen I match if this object is in my instances
dictionary.
I wrote
if self.match_instance('dlg_transactions')== True:return
instead of
if self.match_instance('dlg_transactions')== False:return

nothing happened because it was a logical error

p.s.
phoenix must be a wonderful project...

regards

···

On 14 Mar, 18:12, Robin Dunn <ro...@alldunn.com> wrote:

On 3/14/12 9:39 AM, beppe wrote:

--
Robin Dunn
Software Craftsmanhttp://wxPython.org