having trouble with Toolbook

Patrick J. Anderson wrote:

I'm having trouble with Toolbook. I can't see the image list, below is my code:

        il = wx.ImageList(22, 22)
        for i in images:
            try:
                il.AddIcon(wx.Image(i, wx.BITMAP_TYPE_PNG))

Try this instead:
                   il.Add(wx.Bitmap(i, wx.BITMAP_TYPE_PNG))

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hello,

When calling AddPage you need to tell the page which image to use from the list by telling it the images index.

Currently you are doing this:
         self.AddPage(self.day_mode, "Daily", ID_PLANNER_DAY_MODE)
         self.AddPage(self.week_mode, "Weekly", ID_PLANNER_WEEK_MODE)
         self.AddPage(self.month_mode, "Monthly", ID_PLANNER_MONTH_MODE)

Those calls should look something like this, where 0, 1, 2 are the values of the index returned when you called Add on the image list for the wanted image.

        self.AddPage(self.day_mode, "Daily", imageId=0)
        self.AddPage(self.week_mode, "Daily", imageId=1)
        self.AddPage(self.month_mode, "Daily", imageId=2)

The ID_* values you are passing now are acting as a boolean for the "select" keyword argument of AddPage.

cody

···

On Oct 19, 2007, at 3:41 PM, Patrick J. Anderson wrote:

On Fri, 19 Oct 2007 11:17:56 -0700, Robin Dunn wrote:

Patrick J. Anderson wrote:

I'm having trouble with Toolbook. I can't see the image list, below is
my code:

        il = wx.ImageList(22, 22)
        for i in images:
            try:
                il.AddIcon(wx.Image(i, wx.BITMAP_TYPE_PNG))

Try this instead:
                   il.Add(wx.Bitmap(i, wx.BITMAP_TYPE_PNG))

Thanks, Robin, for your quick reply. That didn't throw an error, but I
still can't see the image list. Do I need to manually Show(it) ? I looked
at the demo, but from the code it seems like it only needs to be assigned
to a toolbook.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org