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@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Hi Werner,
I 'compiled'this sw into .exe-file with Py2exe and ran it by "double-clicking":
1) in Win2k - PC (python sw´s installed)==> Running OK, when started by double-click(as before) !
2) in 'clean' Win 98 - PC (no python sw´s installed) ==> Unfortunately generates Traceback:
Traceback (most recent call last):
File "Morow.py", line 49, in <module>
File "Morow.py", line 15, in create
File "Morow.py", line 25, in __init__
File "Morow.py", line 41, in MyGcCollect
File "wx\_windows.pyo", line 2928, in __init__
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..\..\src\msw\control.cpp(159) in wxControl::MSWCreateControl(): CreateWindowEx("msctls_progress32", flags=52000000, ex=00000200) failed
NOTE: Original TestSW (without GcCollect) could not create any wxWindowClassNR !
3) Original TestSW (without GcCollect) generates Tracebacks:
on 'clean' WinMe PC:
Traceback (most recent call last):
File "Moro.py", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\__init__.pyo", line 45, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\_core.pyo", line 4, in <module>
File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading wx\_core_.pyd
and on 'clean' WinXp PC:
Traceback (most recent call last):
File "Moro.py", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\__init__.pyo", line 45, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\_core.pyo", line 14244, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "wx\_gdi.pyo", line 2972, in <module>
File "wx\_gdi.pyo", line 2781, in AddCatalogLookupPathPrefix
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 33: ordinal not in range(128)
Should we consider these annoying results stating, that (Py2exe)-'compiled' .exe-files cannot run in any other PC´s if Python-Sw´s are not pre-installed ?? (ie. platform/OS/version - conflict)
or
Are there still error somewhere ?
Regards,
Jorma