The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
Dialog application ...
Discuss Dialog application ... in the Python Programming forum on Dev Shed. Dialog application ... Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 20th, 2004, 04:42 AM
|
|
Contributing User
|
|
Join Date: Feb 2004
Posts: 44
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
Dialog application ...
I tried to make dialog based application using wxPython but it doesnt work, I managed to get the Dialog Box but I can put text box, button etc... here's the code... anythingh wrong?
Code:
from wxPython.wx import *
class testdialog(wxDialog):
def _init_(self,parent,ID,title,pos,size):
wxDialog._init__(self,parent,ID,title,pos,size)
self.tHello = wxTextCtrl(panel, -1, '', (3,3), (185,22))
self.bHello = wxTextCtrl(panel, -1, '', (3,30), (185,22))
self.tHello.SetInsertionPoint(1)
button = wxButton(panel, 10, 'Count', (3, 60))
button_clear = wxButton(panel,11,'Clear',(112,60))
class okrun(wxApp):
def OnInit(self):
dlg = testdialog(NULL,-1,'My Dialog',(200,200),(300,120))
dlg.ShowModal()
dlg.Destroy()
return true
app = okrun()
app.MainLoop()
|

February 20th, 2004, 05:31 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
I havn't done much with wxPython so there could be other problems besides this on but as i see it _init_ and _init__ should both be __init__. Try changing that and give it a go  .
Mark.
__________________
programming language development: www.netytan.com – Hula
|

February 20th, 2004, 11:23 AM
|
 |
Mini me.
|
|
Join Date: Nov 2003
Location: Cambridge, UK
|
|
In addition your references to panel should be self:
Code:
from wxPython.wx import *
class testdialog(wxDialog):
def __init__(self,parent,ID,title,pos,size):
from wxPython.lib.layoutf import Layoutf
id = wxNewId()
wxDialog.__init__(self,parent,id,title,pos,size)
panel = self
self.tHello = wxTextCtrl(panel, id,'', (3,3), (185,22))
self.bHello = wxTextCtrl(panel, id, '', (3,30), (185,22))
self.tHello.SetInsertionPoint(1)
button = wxButton(panel, id, 'Count', (3, 60))
button_clear = wxButton(panel,id,'Clear',(112,60))
class okrun(wxApp):
def OnInit(self):
return True
app = okrun(0)
dlg = testdialog(NULL,-1,'My Dialog',(200,200),(300,120))
dlg.ShowModal()
dlg.Destroy()
Now you need to add the event logic
Grim
|

February 21st, 2004, 12:36 PM
|
|
Contributing User
|
|
Join Date: Feb 2004
Posts: 44
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
Thanx Grim it works
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|