wxpython refreshing images in wxpython staticbitmap

1.3k views Asked by At

i need your help, to refresh and change staticbitmap images in wxpython without overlaying onto each other, am building a slotmachine program in python but i have a problem with the staticbitmap stacking on top of each other, whenever i spin the wheel of the slotmachine to display the images... see the image below,thanx in advance.

The screenshot is here --> http://s2.postimg.org/434h21t2x/problem.png

wheel_faces = controller.show_wheel_faces()

            image_list = {"CHERRY":"resources/cherry.png", "ORANGE":"resources/orange.png", 
                         "7":"resources/seven.png", "COIN":"resources/coin.png", 
                         "CLOWN":"resources/clown.png", "APPLE":"resources/apple.png"}

            if wheel_faces != []:
                #print wheel_faces
                wheel1 = wx.EmptyImage()
                wheel1 = wx.Image(image_list.get(wheel_faces[0]), 
wx.BITMAP_TYPE_PNG).ConvertToBitmap()
                wx.StaticBitmap(self, -1, wheel1, pos=(135, 272))


                wheel2 = wx.Image(image_list.get(wheel_faces[1]), 
wx.BITMAP_TYPE_PNG).ConvertToBitmap()
                wx.StaticBitmap(self, -1, wheel2, pos=(276, 272))

                wheel3 = wx.Image(image_list.get(wheel_faces[2]), 
wx.BITMAP_TYPE_PNG).ConvertToBitmap()
                wx.StaticBitmap(self, -1, wheel3, pos=(415, 272))
                self.Refresh()

                self.account_balance += int(controller.show_winnings())

                if controller.show_winnings() != 0:
                    self.payout_label.SetLabel(str(self.account_balance))

                self.spin_label.SetLabel(str(controller.show_winnings()))
                #print controller.balance_manager()
                self.Refresh()
1

There are 1 answers

0
Odatas On

You need to update the wx.StaticBitmap with a new picture.

The command is:

someStaticBitmap.SetBitmap(wx.Bitmap(self.img))

in your code you didn't reference any static bitmap. So you might want to change it so you can put new fotos inside.