The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
The only difference I'm seeing between your code and the code in the demo is this line:
self.SetPyData(tree_child, 'Table %d' % i)
In the demo, they do this:
self.SetPyData(tree_child, None)
Oddly enough, when I tried your code, it worked fine (once I'd replaced all your references to pngs with some of my own). I'm using Windows XP, Python 2.5.2 and wxPython 2.8.9.1 unicode. What are you using?
Mike
···
keith schrieb:
Sorry-I was wrong, but that looked obvious to me. range actually
doesn't need two integers. I'll go back to sleep now.
keith wrote:
range needs two integers--ie.
for i in range(0,10):
Keith
Johannes Schönberger wrote:
Hi,
I built a TreeCtrl and I'm always getting this error:
"Segmentation Fault"
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
I'm using Ubuntu 8.10, Python 2.5.2, wxPython 2.8.8.0 - perhaps my pngs are broken...
Thank You!
Mike Driscoll schrieb:
···
Johannes Schönberger wrote:
Any other ideas?
The only difference I'm seeing between your code and the code in the demo is this line:
self.SetPyData(tree_child, 'Table %d' % i)
In the demo, they do this:
self.SetPyData(tree_child, None)
Oddly enough, when I tried your code, it worked fine (once I'd replaced all your references to pngs with some of my own). I'm using Windows XP, Python 2.5.2 and wxPython 2.8.9.1 unicode. What are you using?
Mike
keith schrieb:
Sorry-I was wrong, but that looked obvious to me. range actually
doesn't need two integers. I'll go back to sleep now.
keith wrote:
range needs two integers--ie.
for i in range(0,10):
Keith
Johannes Schönberger wrote:
Hi,
I built a TreeCtrl and I'm always getting this error:
"Segmentation Fault"
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
I found out, that the imagelist is the problem. When I remove SetImageList, the script works. Any ideas what's wrong about my imagelist?
Mike Driscoll schrieb:
···
Johannes Schönberger wrote:
Any other ideas?
The only difference I'm seeing between your code and the code in the demo is this line:
self.SetPyData(tree_child, 'Table %d' % i)
In the demo, they do this:
self.SetPyData(tree_child, None)
Oddly enough, when I tried your code, it worked fine (once I'd replaced all your references to pngs with some of my own). I'm using Windows XP, Python 2.5.2 and wxPython 2.8.9.1 unicode. What are you using?
Mike
keith schrieb:
Sorry-I was wrong, but that looked obvious to me. range actually
doesn't need two integers. I'll go back to sleep now.
keith wrote:
range needs two integers--ie.
for i in range(0,10):
Keith
Johannes Schönberger wrote:
Hi,
I built a TreeCtrl and I'm always getting this error:
"Segmentation Fault"
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
I found out, that the imagelist is the problem. When I remove SetImageList, the script works. Any ideas what's wrong about my imagelist?
Well, you might check and make sure all your images are actually 16x16 since that's the size you have set. I used only 16x16 images in my test. If that is what you are using, then try opening each of them in an image editor and make sure they can load correctly. Maybe one of them is corrupted.
Mike
···
Mike Driscoll schrieb:
Johannes Schönberger wrote:
Any other ideas?
The only difference I'm seeing between your code and the code in the demo is this line:
self.SetPyData(tree_child, 'Table %d' % i)
In the demo, they do this:
self.SetPyData(tree_child, None)
Oddly enough, when I tried your code, it worked fine (once I'd replaced all your references to pngs with some of my own). I'm using Windows XP, Python 2.5.2 and wxPython 2.8.9.1 unicode. What are you using?
Mike
keith schrieb:
Sorry-I was wrong, but that looked obvious to me. range actually
doesn't need two integers. I'll go back to sleep now.
keith wrote:
range needs two integers--ie.
for i in range(0,10):
Keith
Johannes Schönberger wrote:
Hi,
I built a TreeCtrl and I'm always getting this error:
"Segmentation Fault"
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
They definitely exist, htey are not corrupted. I think the way I'm creating them is wrong:
database_table_image = image_list.Add(wx.Bitmap('res/images/database_table.png', wx.BITMAP_TYPE_PNG))
But I don't know how to do it differently...
Hmmm...I don't use this control, but looking at the Demo and Google, this seems like the right way to do it. The first argument of Add() is a bitmap and the 2nd is a mask, which doesn't seem to be required. Seeing as I just copied a path to my files and pasted it over every path you had and it worked, I don't think you're doing anything wrong...
I just copied my copy of the code to my Ubuntu 8.1 VM and I get a Segmentation Fault there as well. I have wxPython 2.8.9.1 on there, so it's not a version issue. If no one else pops in with advice, I would recommend filing a GTK-only bug report.
Mike
···
Mike Driscoll schrieb:
Johannes Schönberger wrote:
I found out, that the imagelist is the problem. When I remove SetImageList, the script works. Any ideas what's wrong about my imagelist?
Well, you might check and make sure all your images are actually 16x16 since that's the size you have set. I used only 16x16 images in my test. If that is what you are using, then try opening each of them in an image editor and make sure they can load correctly. Maybe one of them is corrupted.
Mike
Mike Driscoll schrieb:
Johannes Schönberger wrote:
Any other ideas?
The only difference I'm seeing between your code and the code in the demo is this line:
self.SetPyData(tree_child, 'Table %d' % i)
In the demo, they do this:
self.SetPyData(tree_child, None)
Oddly enough, when I tried your code, it worked fine (once I'd replaced all your references to pngs with some of my own). I'm using Windows XP, Python 2.5.2 and wxPython 2.8.9.1 unicode. What are you using?
Mike
keith schrieb:
Sorry-I was wrong, but that looked obvious to me. range actually
doesn't need two integers. I'll go back to sleep now.
keith wrote:
range needs two integers--ie.
for i in range(0,10):
Keith
Johannes Schönberger wrote:
Hi,
I built a TreeCtrl and I'm always getting this error:
"Segmentation Fault"
The error has to be in here:
tree_root = self.AddRoot('Database')
self.SetPyData(tree_root, 'Database')
self.SetItemImage(tree_root, database_image, wx.TreeItemIcon_Normal)
for i in range(10):
tree_child = self.AppendItem(tree_root, 'Table %d' % i)
self.SetPyData(tree_child, 'Table %d' % i)
self.SetItemImage(tree_child, database_table_image,
wx.TreeItemIcon_Normal)
self.Expand(tree_root)
Becuase if I remove this part, everything works well... Any idea
what's wrong about that?
Thank You!
Johannes Schönberger
------------------------------------------------------------------------
I found out, that the imagelist is the problem. When I remove SetImageList, the script works. Any ideas what's wrong about my imagelist?
SetImageList does not give ownership of the image list to the tree control (at the C++ level) and since you are not saving a reference to the Python proxy object that does own the image list then it is being destroyed, and later on the tree ctrl is trying to use it. You either need to use AssignImageList instead or save a reference to the image list yourself.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I found out, that the imagelist is the problem. When I remove SetImageList, the script works. Any ideas what's wrong about my imagelist?
SetImageList does not give ownership of the image list to the tree control (at the C++ level) and since you are not saving a reference to the Python proxy object that does own the image list then it is being destroyed, and later on the tree ctrl is trying to use it. You either need to use AssignImageList instead or save a reference to the image list yourself.