Platform<=>version conflict or what?

Jorma Paavola Jorma.Paavola at Elisanet.fi
Sat May 12 13:27:58 PDT 2007


Werner F. Bruhin kirjoitti:
> Hi Jorma,
> 
> Jorma Paavola wrote:
>> ....
>> - I tested gc.collect() in other test-modules and it works (of course) !
>>
>> However when I call MyGcCollect()-function from my TestGUI-sw I get 
>> error:
>>> self.dlgPro.Destroy()
>>> AttributeError: 'int' object has no attribute 'dlgPro'
> Can you show your code.
>>
>> Also when I force wx.ProgressDialog to run I get error:
>>> NameError: global name '_' is not defined
> My texts are all using the "_" macro as my application is translated 
> into multiple languages.
> 
> Just change this:
> self.dlgPro = wx.ProgressDialog(_('Windows 9x - forcing release of 
> resources'),
> 
> to this:
> self.dlgPro = wx.ProgressDialog('Windows 9x - forcing release of 
> resources',  etc.......
> 
> Werner

Hi Werner,

My Test code (forcing to run ProgressDialog):

===================================================================================

# -*- coding: cp1252 -*-
# version(Ansi/Unicode) valinta suoraan command-promptista wx.pth:oon
# wxversion.select("ver")komennolla
# -*- coding: cp1252 -*-
#-----------------------------------------------------------
# Hakee Windows version
#
import gc
import sys
import wx
#
class Frame(wx.Frame):
     def __init__(self, parent):
         wx.Frame.__init__(self, parent, title="Hello")
#
runningPlatform = sys.getwindowsversion()
# Palauttaa resurssit mikäli Windows 9x
#--------------------------------------------------------------
def MyGcCollect(self, message='', max=0, done=0):
     if runningPlatform[0] == 5: # 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()
             mypub.publisher.sendMessage(mypub.statusText, message)
     x = gc.collect()
#
# GUI-testisovellus
#---------------------------------------------------------------------
#
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 ?

Regards,

Jorma








More information about the wxpython-users mailing list