def InitUI(self): mainWindow = wx.Panel(self) hbox = wx.BoxSizer(wx.HORIZONTAL) # Create 2 bitmaps for the button button_mic = wx.Bitmap("mic.png", wx.BITMAP_TYPE_PNG) button_cam = wx.Bitmap("cam.png", wx.BITMAP_TYPE_PNG) button_menu = wx.Bitmap("menu.png", wx.BITMAP_TYPE_PNG) button_play = wx.Bitmap("play.png", wx.BITMAP_TYPE_PNG) mic = wx.BitmapButton(mainWindow, 1, button_mic, (-1, -1), (55, 55)) cam = sb.SBitmapButton(mainWindow, 2, button_cam, (-1, -1), (55, 55)) menu = sb.SBitmapButton(mainWindow, 3, button_menu, (-1, -1), (55, 55)) play = sb.SBitmapButton(mainWindow, 4, button_play, (-1, -1), (55, 55)) ws_before = wx.StaticText(mainWindow, label="") ws_after = wx.StaticText(mainWindow, label="") hbox.Add(ws_before, 2, wx.EXPAND, 5) # Whitespace on the Left hbox.Add(mic, 1, wx.ALIGN_LEFT, 5) hbox.Add(cam, 1, wx.ALIGN_LEFT, 5) hbox.Add(menu, 1, wx.ALIGN_LEFT, 5) hbox.Add(play, 1, wx.ALIGN_LEFT, 5) hbox.Add(ws_after, 2, wx.EXPAND, 5) # Whitespace on the right play.SetUseFocusIndicator(False) #mic.SetUseFocusIndicator(False) cam.SetUseFocusIndicator(False) menu.SetUseFocusIndicator(False) mainWindow.SetSizer(hbox)
def test_lib_agw_shapedbutton2(self): btn = SB.SButton(self.frame, label='label') btn.SetEllipseAxis(2.0, 1.0) bmp = wx.Bitmap(pngFile) btn = SB.SBitmapButton(self.frame, -1, bitmap=bmp) btn.SetEllipseAxis(2.0, 1.0) self.assertEqual(btn.GetEllipseAxis(), (2.0, 1.0))
def CreateImageButton(self, parent, function, filename="Defenseup", size=(100, 100), pos=(0, 0)): path = "assets\\{}.png".format(filename) bmp = wx.Image(path, wx.BITMAP_TYPE_PNG).Scale(size[0], size[1]) bmp = bmp.ConvertToBitmap() button = SB.SBitmapButton(parent, -1, bmp, pos) button.SetButtonColour(wx.Colour(0, 0, 0, 0)) self.Bind(wx.EVT_BUTTON, function, button) return button
def test_lib_agw_shapedbutton1(self): btn = SB.SButton(self.frame, label='label') btn = SB.SButton(self.frame, -1, 'label', (10, 10), (100, -1)) bmp = wx.Bitmap(pngFile) btn = SB.SBitmapButton(self.frame, -1, bitmap=bmp) btn = SB.SBitmapTextButton(self.frame, -1, label='label', bitmap=bmp) btn.SetBitmapFocus(bmp) btn.SetBitmapDisabled(bmp) btn.SetBitmapSelected(bmp) btn = SB.SBitmapToggleButton(self.frame, -1, bitmap=bmp) btn.SetToggle(True) self.assertTrue(btn.GetValue()) self.assertEqual(btn.GetBitmapLabel(), bmp)