473,378 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Icons in wxTreeCtrl using py2exe

1
I have implemented the following simple python script by means of the BOA Constructor 0.6.1:

Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame1
  2.  
  3. import wx
  4.  
  5. def create(parent):
  6.     return Frame1(parent)
  7.  
  8. [wxID_FRAME1, wxID_FRAME1TREECTRL1, 
  9. ] = [wx.NewId() for _init_ctrls in range(2)]
  10.  
  11. [wxID_FRAME1TOOLBAR1TOOLS0] = [wx.NewId() for _init_coll_toolBar1_Tools in range(1)]
  12.  
  13.  
  14. class Frame1(wx.Frame):
  15.     def _init_coll_imageList1_Images(self, parent):
  16.         # generated method, don't edit
  17.  
  18.         parent.Add(bitmap=wx.Bitmap(u'D:/tmp/IconExe/treeCtrl/Icon.bmp',
  19.               wx.BITMAP_TYPE_BMP), mask=wx.NullBitmap)
  20.  
  21.     def _init_utils(self):
  22.         # generated method, don't edit
  23.         self.imageList1 = wx.ImageList(height=16, width=16)
  24.         self._init_coll_imageList1_Images(self.imageList1)
  25.  
  26.     def _init_ctrls(self, prnt):
  27.         # generated method, don't edit
  28.         wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
  29.               pos=wx.Point(642, 398), size=wx.Size(400, 250),
  30.               style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
  31.         self._init_utils()
  32.         self.SetClientSize(wx.Size(392, 216))
  33.  
  34.         self.treeCtrl1 = wx.TreeCtrl(id=wxID_FRAME1TREECTRL1, name='treeCtrl1',
  35.               parent=self, pos=wx.Point(0, 0), size=wx.Size(392, 216),
  36.               style=wx.TR_HAS_BUTTONS)
  37.  
  38.     def __init__(self, parent):
  39.         self._init_ctrls(parent)
  40.  
  41.         self.treeCtrl1.SetImageList(self.imageList1)
  42.  
  43.         self.root = self.treeCtrl1.AddRoot("The Root Item")
  44.         self.treeCtrl1.SetPyData(self.root, None)
  45.         self.treeCtrl1.SetItemImage(self.root, 0, wx.TreeItemIcon_Normal)
  46.         self.treeCtrl1.SetItemImage(self.root, 0, wx.TreeItemIcon_Expanded)
  47.  
  48.  
  49. if __name__ == '__main__':
  50.     app = wx.App()
  51.     frame = create(None)
  52.     frame.Show()
  53.  
  54.     app.MainLoop()

This script creates a root item in a wxTreeCtrl with an Icon. If I start the script then it is working.
I am using:
- Windows XP
- python 2.7
- wxpython 2.9.4
- py2exe 0.6.9

If I generate an exe file from my python script by means of py2exe (without any error) then I cannot see the Icon before the root item.

I used the following setup.py python script:

from distutils.core import setup
import py2exe

Expand|Select|Wrap|Line Numbers
  1. setup(
  2.         options = {"py2exe": {"compressed": 1,
  3.                               "optimize": 2,
  4.                               "ascii": 1,
  5.                               "bundle_files": 1,
  6.  
  7.                              },
  8.                   },
  9.         zipfile = None,
  10.         windows = [
  11.             {
  12.                 "script": "./../Frame1.py",
  13.             }
  14.         ],
  15.      )
If I use python 2.5 with wxpython 2.8 for the same thing then the exe is working as well and I can see the Icon before the root item.

What shall I do to be able to see the icon before the root item during the exe file execution under python 2.7, wxpython 2.9.4???

Thanks in advance
Jan 10 '13 #1
0 1426

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Sarah Mount | last post by:
Hi everyone. I'm trying to create an exe for a simple pygame app on Win XP. I think I've got the latest (python, py2exe, pygame) and my setup.py file looks like this: | from distutils.core...
0
by: upward_spiral2001 | last post by:
Hi. I've got a neat artificial intelligence project I want to distribute as an EXE. I'm using Python, Pygame, and Numeric. My problem is: When I use py2exe, I'm told "The following modules appear...
0
by: kschnee | last post by:
Hi. I've got a neat artificial intelligence project I want to distribute as an EXE. I'm using Python, Pygame, and Numeric. My problem is: When I use py2exe, I'm told "The following modules appear...
11
by: Grant Edwards | last post by:
I'm trying in vain to set the icon for the executable generated by py2exe. According to various sources there are two answers: 1) Do it on the command line: python setup.py py2exe --icon...
2
by: Maria.Reinhammar | last post by:
I have an app using active_directory.py and the std module asyncore in a Windows Service. Works perfectly! That is, until I try to use py2exe to create a standalone (need to avoid installing the...
7
Loismustdie129
by: Loismustdie129 | last post by:
I need help with a py2exe example I am working on to get the basics. The example is: # setup.py from distutils.core import setup import py2exe setup(name="wxTail",scripts=,) I type this in...
4
true911m
by: true911m | last post by:
Here's a little walkthrough to get py2exe up and running. I'm not an expert, so I can't help much with any problems you might have. This is what worked for me. The result here will be to convert...
3
by: vajratkarviraj | last post by:
i hav python2.5, matplotlib0.90.1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.py) which uses the matplotlib package... and i want 2 make an exe of it for distribution...
2
AvrilSun00
by: AvrilSun00 | last post by:
Hello! In my program, i use bmp to my controls, like radio button, checkbox, and these controls will have a bmp look. But then i use py2exe to my problem, the controls, like radio button,...
2
by: Chriskim | last post by:
I wrote a program that uses PyQt4, mathplotlib to generates graphs. I made a executable file using Py2exe. Everything is working fine, but when I exit from my program, a window message pops...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.