Platform<=>version conflict or what?

Jorma Paavola Jorma.Paavola at Elisanet.fi
Sun May 13 02:24:38 PDT 2007


Werner F. Bruhin kirjoitti:
> Hi Jorma,
> 
> Jorma Paavola wrote:
>> Werner F. Bruhin kirjoitti:
>> ...
>> if __name__ == "__main__":
>>     app = wx.PySimpleApp()
>>     MyGcCollect('','Test',1,1)
>>     frame = Frame(None)
>>     frame.Show()
>>     app.MainLoop()
>>
>> gives now error message:
>>
>> Traceback (most recent call last):
>>   File "C:\Documents and Settings\Administrator\My Documents\Omat 
>> softat\Morod.py", line 38, in <module>
>>     MyGcCollect('','Test',1,1)
>>   File "C:\Documents and Settings\Administrator\My Documents\Omat 
>> softat\Morod.py", line 26, in MyGcCollect
>>     wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
>> AttributeError: 'str' object has no attribute 'dlgPro'
>>
>> =========================================================================
>>
>> and opens ProgressDialog-window in "Tilt-state" !
>>
>> Obviously my functioncall-parameters are invalid ? - but how ?
> You are calling MyGcCollect with a string ('') as the first parameter.
> 
> Try the enclosed sample, just change this line:
> if runningPlatform[0] == 6:
> 
> according to your test platform.
> 
> Werner
> 
> 
> ------------------------------------------------------------------------
> 
> #Boa:Frame:Frame1
> 
> import wx
> import gc
> import sys
> 
> runningPlatform = sys.getwindowsversion()
> 
> def create(parent):
>     return Frame1(parent)
> 
> [wxID_FRAME1] = [wx.NewId() for _init_ctrls in range(1)]
> 
> class Frame1(wx.Frame):
>     def _init_ctrls(self, prnt):
>         wx.Frame.__init__(self, style=wx.DEFAULT_FRAME_STYLE, name='', parent=prnt, title='Frame1', pos=wx.Point(-1, -1), id=wxID_FRAME1, size=wx.Size(-1, -1))
> 
>     def __init__(self, parent):
>         self._init_ctrls(parent)
>         self.MyGcCollect('Test',3,1)
>         wx.Sleep(2)
>         wx.YieldIfNeeded()
>         self.MyGcCollect('Test',3,2)
>         wx.Sleep(2)
>         wx.YieldIfNeeded()
>         self.MyGcCollect('Test',3,3)        
>         
> 
>     def MyGcCollect(self, message='', max=0, done=0):
>         if runningPlatform[0] == 6: # Testaa onko Windows 9x
>             if done == 1:
>                 self.dlgPro = wx.ProgressDialog('Windows 9x - forcing release of resources',
>                                                 message,
>                                                 max,
>                                                 None,
>                                                 wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
>             self.dlgPro.Update(done, message)
>             if done == max:
>                 self.dlgPro.Destroy()
>         x = gc.collect()
> 
> if __name__ == '__main__':
>     app = wx.PySimpleApp()
>     frame = create(None)
>     frame.Show()
> 
>     app.MainLoop()
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
Hi Werner !

Thanks a lot !

Very clever idea to use three different "delay-loops" to control 
proceeding of GcCollect !!
(I could not figure out that myself !)
Obviously the complete declaration/initialization used by you also 
transfers the argumets correctly to GcCollect-function.
I tried this with Win2k and it works perfectly !
I named the loops differently and I found out, that GcCollect took abt. 
1.1 sek in my PC used.
Now I´ll test it on other OS´s.

Regards,

Jorma Paavola





More information about the wxpython-users mailing list