[wxPython-users] Re: Platform<=>version conflict or what?

Werner F. Bruhin werner.bruhin at free.fr
Sun May 13 00:58:59 PDT 2007


Hi Jorma,

Jorma Paavola wrote:
> Werner F. Bruhin kirjoitti:
> ...
> if __name__ =3D=3D "__main__":
>     app =3D wx.PySimpleApp()
>     MyGcCollect('','Test',1,1)
>     frame =3D 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'
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> 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] =3D=3D 6:

according to your test platform.

Werner
-------------- next part --------------
#Boa:Frame:Frame1

import wx
import gc
import sys

runningPlatform =3D sys.getwindowsversion()

def create(parent):
    return Frame1(parent)

[wxID_FRAME1] =3D [wx.NewId() for _init_ctrls in range(1)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self, style=3Dwx.DEFAULT_FRAME_STYLE, name=3D'', =
parent=3Dprnt, title=3D'Frame1', pos=3Dwx.Point(-1, -1), id=3DwxID_FRAME1, =
size=3Dwx.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=3D'', max=3D0, done=3D0):
        if runningPlatform[0] =3D=3D 6: # Testaa onko Windows 9x
            if done =3D=3D 1:
                self.dlgPro =3D wx.ProgressDialog('Windows 9x - forcing rel=
ease of resources',
                                                message,
                                                max,
                                                None,
                                                wx.PD_AUTO_HIDE | wx.PD_APP=
_MODAL)
            self.dlgPro.Update(done, message)
            if done =3D=3D max:
                self.dlgPro.Destroy()
        x =3D gc.collect()

if __name__ =3D=3D '__main__':
    app =3D wx.PySimpleApp()
    frame =3D create(None)
    frame.Show()

    app.MainLoop()


More information about the wxpython-users mailing list