- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要你的帮助,以刷新和更改 wxpython 中的静态位图图像而不相互重叠,我正在用 python 构建一个 slotmachine 程序但是我遇到了静态位图堆叠在彼此之上的问题,每当我旋转轮子时显示图像的老虎机...见下图,提前谢谢。
截图在这里--> 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()
最佳答案
您需要用新图片更新 wx.StaticBitmap。
命令是:
someStaticBitmap.SetBitmap(wx.Bitmap(self.img))
在您的代码中您没有引用任何静态位图。所以你可能想改变它,这样你就可以把新的照片放进去。
关于python - wxpython在wxpython staticbitmap中刷新图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30841181/
我想要一个窗口,其中的图片根据无限循环期间发生的事情而变化。 想象一下有人四处走动,当他离开给定的轨道时,程序应该显示一个指向轨道方向的箭头。因此我有一个程序可以确定用户和轨道之间的距离,但我不知道如
我的 wxPython 项目有一个框架,有多个嵌套的 sizer。 其中一个 sizer 包含一个带有从文件读取的位图的 wxStaticImage。 每次调整框架大小时,我都需要调整图像大小(增大/
我的应用程序具有以下结构: class GameWindow(wx.Frame): imageFile = r"C:\Users\Trufa\Desktop\pyll\img\ball.png
我想在 StaticBitmap 上创建悬停效果 - 如果鼠标光标在位图上,则显示一张图像,否则显示第二张图像。这是一个简单的程序(与按钮完美配合)。但是,StaticBitmap 不会发出 EVT_
在持续失败 1 周后,我仍然无法完成一项简单的任务:加载带有 alpha channel 或白色背景的 png(在下面的示例中)并让它在 wx.StaticBitmap 中保持其透明度。 稍后我需要在
我想要一个 python 图形用户界面,它可以从文件中加载不同的图像。我见过许多使用以下代码加载图像的示例: img = wx.Image("1.jpg", wx.BITMAP_TYPE_ANY, -
我是一名优秀的程序员,十分优秀!