[Tutor] First step
Pol Branckotte
polbranckotte@skynet.be
Thu, 15 Aug 2002 12:27:02 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C24457.0F4B1EA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I just try to define a window and later decide to make it visible:
Here are the two programs, I can understand the error message generated =
by the first
but not the one generated by the second
What am I missing?
How to make it happen?
from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame =3D wxFrame(NULL, -1, "hello from wxPy")
#frame.Show(true)
self.SetTopWindow(frame)
return true
app =3D MyApp(0)
app.frame.Show(true)
app.MainLoop()
attribute error: MyApp instance has no attribute 'frame'
__________________________________________________
from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame =3D wxFrame(NULL, -1, "hello from wxPy")
#frame.Show(true)
self.SetTopWindow(frame)
return true
app =3D MyApp(0)
frame.Show(true)
app.MainLoop()
name error name "frame" is not defined
__________________________________________________________
Thanks=20
Pol
------=_NextPart_000_0005_01C24457.0F4B1EA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#fcfcfc>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>I just try to define a =
window and=20
later decide to make it visible:</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>Here are the two =
programs, I can=20
understand the error message generated by the first</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>but not the one =
generated by the=20
second</FONT><FONT face=3DArial color=3D#000000 size=3D2></FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>What am I =
missing?</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>How to make it =
happen?</FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>from wxPython.wx import =
*</FONT>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>class=20
MyApp(wxApp):<BR> def=20
OnInit(self):<BR> frame =3D=20
wxFrame(NULL, -1, "hello from=20
wxPy")<BR> =20
#frame.Show(true)<BR> =20
self.SetTopWindow(frame)<BR> =
return=20
true</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>app =3D=20
MyApp(0)<BR>app.frame.Show(true)<BR>app.MainLoop()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>attribute error: MyApp =
instance has=20
no attribute=20
'frame'<BR>__________________________________________________</FONT></DIV=
></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>from wxPython.wx import =
*</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>class=20
MyApp(wxApp):<BR> def=20
OnInit(self):<BR> frame =3D=20
wxFrame(NULL, -1, "hello from=20
wxPy")<BR> =20
#frame.Show(true)<BR> =20
self.SetTopWindow(frame)<BR> =
return=20
true</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>app =3D=20
MyApp(0)<BR>frame.Show(true)<BR>app.MainLoop()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2>name error name "frame" =
is not=20
defined<BR>__________________________________________________________<BR>=
</FONT><FONT=20
face=3DArial color=3D#000000 size=3D2>Thanks </FONT></DIV>
<DIV><FONT face=3DArial color=3D#000000 size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#000000 =
size=3D2>Pol</FONT></DIV></BODY></HTML>
------=_NextPart_000_0005_01C24457.0F4B1EA0--