Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Help: GUI wxGlade/traits linkage

Reply
Thread Tools

Help: GUI wxGlade/traits linkage

 
 
Donald 'Paddy' McCarthy
Guest
Posts: n/a
 
      10-19-2003
Hi,
I am having a few problems with a GUI. I am new to traits and wxGlade.
I have used wxGlade to create a Form with an embedded space for a
CustomWidget.

I have the traits demo and would like to edit the traits and have the
traits form appear instead of the space left for my CustomWidget.

wxGlade produces code with the following hook (last line):

class MyFrame(wxFrame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wxDEFAULT_FRAME_STYLE
wxFrame.__init__(self, *args, **kwds)
self.btTraits = CustomWidget(self, -1)
<<snip>>


So with the traits example code of:

import traits
import traits.wxtrait_sheet
class Person ( traits.HasTraits ):
__traits__ = {
'name': '',
'age': 9,
'weight': 0.0
}
bill = Person()


From reading the traits doc I thought that I would just need to change
the call to CustomWidget above to:
self.btTraits = traits.wxtrait_sheet.TraitSheet ( wxFrame, bill)

But that leads to the following error:

$ pythone btF.py
Traceback (most recent call last):
File "btF.py", line 84, in ?
frame_1 = MyFrame(None, -1, "")
File "btF.py", line 29, in __init__
self.btTraits = traits.wxtrait_sheet.TraitSheet ( wxFrame, bill)
File
"C:\Python23_Enthought\lib\site-packages\traits\wxtrait_sheet.py", line 3
22, in __init__
wx.wxPanel.__init__( self, parent, -1 )
File ".\site-packages\wxPython\windows.py", line 696, in __init__
TypeError: Type error in argument 1 of new_wxPanel. Expected _wxWindow_p.



I would be grateful for a little help.

Thanks, Paddy.


 
Reply With Quote
 
 
 
 
Donald 'Paddy' McCarthy
Guest
Posts: n/a
 
      10-19-2003
I found it!
It seems that the following line made the connection:

self.btTraits = traits.wxtrait_sheet.TraitSheet ( self, bill)


Donald 'Paddy' McCarthy wrote:
> Hi,
> I am having a few problems with a GUI. I am new to traits and wxGlade.
> I have used wxGlade to create a Form with an embedded space for a
> CustomWidget.
>
> I have the traits demo and would like to edit the traits and have the
> traits form appear instead of the space left for my CustomWidget.
>
> wxGlade produces code with the following hook (last line):
>
> class MyFrame(wxFrame):
> def __init__(self, *args, **kwds):
> # begin wxGlade: MyFrame.__init__
> kwds["style"] = wxDEFAULT_FRAME_STYLE
> wxFrame.__init__(self, *args, **kwds)
> self.btTraits = CustomWidget(self, -1)
> <<snip>>
>
>
> So with the traits example code of:
>
> import traits
> import traits.wxtrait_sheet
> class Person ( traits.HasTraits ):
> __traits__ = {
> 'name': '',
> 'age': 9,
> 'weight': 0.0
> }
> bill = Person()
>
>
> From reading the traits doc I thought that I would just need to change
> the call to CustomWidget above to:
> self.btTraits = traits.wxtrait_sheet.TraitSheet ( wxFrame, bill)
>
> But that leads to the following error:
>
> $ pythone btF.py
> Traceback (most recent call last):
> File "btF.py", line 84, in ?
> frame_1 = MyFrame(None, -1, "")
> File "btF.py", line 29, in __init__
> self.btTraits = traits.wxtrait_sheet.TraitSheet ( wxFrame, bill)
> File
> "C:\Python23_Enthought\lib\site-packages\traits\wxtrait_sheet.py", line 3
> 22, in __init__
> wx.wxPanel.__init__( self, parent, -1 )
> File ".\site-packages\wxPython\windows.py", line 696, in __init__
> TypeError: Type error in argument 1 of new_wxPanel. Expected _wxWindow_p.
>
>
>
> I would be grateful for a little help.
>
> Thanks, Paddy.
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Baseline GUI Architecture (was: Baseline GUI Prototype?) Stefan Ram Java 3 11-20-2011 02:18 AM
c++ linkage vs c linkage ramasubramanian.rahul@gmail.com C++ 1 09-12-2008 11:41 AM
PyGTK GUI update without signals from GUI Andrew Lapidas Python 0 04-12-2008 11:07 PM
GUI - GUI value passing paul.foreman Java 5 10-25-2004 08:06 AM
[PY GUI] interest function in python GUI(wxpython,pyqt) program.wxpython,pyqt ulysses Python 4 10-22-2003 03:28 PM



Advertisments