I've put together a code to make a periodic table with jpeg bitmap buttons, and here's the code:
element_list = ["H.jpg","He.jpg","Li.jpg"] for i in range(len(element_list)): image_id = int(i+1) image_current = wx.Image("/Applications/PeriodicTable/ButtonBitMap/%s" % element_list[i], wx.BITMAP_TYPE_ANY).ConvertToBitmap() current = wx.BitmapButton(self,id=image_id,bitmap=image_current,style=wx.BORDER_NONE) main.Add(current,1)
I've done the id, because for some reason, I can't figure out how to reference the button itself. For instance, if I make He = wx.BitmatButton(etc...), how do I get the He in my bound event (so I can run ELEMENTS[He]), so I can have all the buttons reference one event? If I could do this, I wouldn't have to mess around with ID's (which I've heard is a bad idea).