473,657 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: GUI wxGlade/traits linkage

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(se lf, -1)
<<snip>>
So with the traits example code of:

import traits
import traits.wxtrait_ sheet
class Person ( traits.HasTrait s ):
__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.TraitShee t ( 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.TraitShee t ( wxFrame, bill)
File
"C:\Python23_En thought\lib\sit e-packages\traits \wxtrait_sheet. py", line 3
22, in __init__
wx.wxPanel.__in it__( self, parent, -1 )
File ".\site-packages\wxPyth on\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.
Jul 18 '05 #1
1 1689
I found it!
It seems that the following line made the connection:

self.btTraits = traits.wxtrait_ sheet.TraitShee t ( 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(se lf, -1)
<<snip>>
So with the traits example code of:

import traits
import traits.wxtrait_ sheet
class Person ( traits.HasTrait s ):
__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.TraitShee t ( 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.TraitShee t ( wxFrame, bill)
File
"C:\Python23_En thought\lib\sit e-packages\traits \wxtrait_sheet. py", line 3
22, in __init__
wx.wxPanel.__in it__( self, parent, -1 )
File ".\site-packages\wxPyth on\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.


Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1863
by: Al Dykes | last post by:
I'm looking for info on programming with glade on python, and maybe some sample code to hack. I've got python installed, but need a howto for glade and google doesn't help me. Any suggestions ?
2
1693
by: crystalattice | last post by:
I'm making a GUI for a console-based program I just wrote. I figured it would be mostly straight forward to convert it over in wxPython but now I'm confused. In my console program, I have __init__ making the dictionaries et al. and then my methods will populate them. However, when I use wxGlade under SPE to make the GUI, wxGlade makes it's own __init__. I know not to add anything to this section because it's written over everytime I...
6
6207
by: shuf | last post by:
Hello, I am running python 2.4.4 with wxpython 2.6 on Fedora 6. I am trying to set the font color of individual elements in a listbox, but I am not able to with SetItemForegroundColour() (this method does not appear to do anything): #!/usr/bin/env python # -*- coding: UTF-8 -*- # generated by wxGlade 0.4.1 on Thu Mar 22 12:15:29 2007 import wx
4
1557
by: T.Crane | last post by:
Hi, I'm new to C++, and I want to open a file, go through it line by line and pull out specific things on each line. I've written a test bit of code to try to do this. For some reason what I'm doing doesn't work -- it returns a runtime error and I don't know why. Obviously there's something wrong with how I'm interpreting whatever is returned by the getline function. Does the getline function not return a string? If it does, why do...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.