コード例 #1
0
    def BuildEllipticButtons(self):

        # Here We Build Elliptic Buttons. Elliptic Buttons Are Somewhat
        # More Hostiles To Handle, Probably Because My Implementation
        # Is Lacking Somewhere, But They Look Nice However.

        esizer = wx.FlexGridSizer(2, 2, 5, 5)

        btn1 = SButton(self.panel, -1, "Ellipse 1")
        btn1.SetEllipseAxis(2, 1)
        btn1.SetButtonColour(wx.RED)
        btn1.SetLabelColour(wx.WHITE)
        btn1.SetFont(
            wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False))
        btn1.Bind(wx.EVT_BUTTON, self.OnEllipse)

        btn2 = SButton(self.panel, -1, "Ellipse 2")
        btn2.SetEllipseAxis(2, 3)
        btn2.SetAngleOfRotation(90)
        btn2.SetLabelColour(wx.BLUE)
        btn2.SetFont(
            wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, True))
        btn2.Bind(wx.EVT_BUTTON, self.OnEllipse)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "ffwd.png"),
                        wx.BITMAP_TYPE_PNG)
        btn3 = SBitmapTextToggleButton(self.panel, -1, bmp, "FFWD")
        bmp = wx.Bitmap(os.path.join(bitmapDir, "rewind.png"),
                        wx.BITMAP_TYPE_PNG)
        btn3.SetBitmapSelected(bmp)
        btn3.SetEllipseAxis(1.4, 1)
        btn3.Bind(wx.EVT_BUTTON, self.OnFFWDRewind)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "round.png"),
                        wx.BITMAP_TYPE_PNG)
        btn4 = SBitmapButton(self.panel, -1, bmp)
        btn4.SetEllipseAxis(1, 1.4)
        btn4.Bind(wx.EVT_BUTTON, self.OnRound)

        esizer.Add(btn1, 1, wx.EXPAND | wx.ALL, 5)
        esizer.Add(btn2, 1, wx.EXPAND | wx.ALL, 5)
        esizer.Add(btn3, 1, wx.EXPAND | wx.ALL, 5)
        esizer.Add(btn4, 1, wx.EXPAND | wx.ALL, 5)

        esizer.AddGrowableRow(0)
        esizer.AddGrowableRow(1)
        esizer.AddGrowableCol(0)
        esizer.AddGrowableCol(1)

        return esizer
コード例 #2
0
    def BuildMixedButtons(self):

        # Here We Build Some Buttons/Toggles With Different Properties
        # Notice That We Put Some Images Also For The "Selected" State
        # For A Button

        btsizer = wx.FlexGridSizer(2, 2, 5, 5)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "italy.gif"),
                        wx.BITMAP_TYPE_GIF)
        btn1 = SBitmapButton(self.panel, -1, bmp)
        bmp = wx.Bitmap(os.path.join(bitmapDir, "canada.gif"),
                        wx.BITMAP_TYPE_GIF)
        btn1.SetBitmapSelected(bmp)
        btn1.Bind(wx.EVT_BUTTON, self.OnItalyCanada)

        bmp = wx.Bitmap(os.path.join(bitmapDir, "stop.png"),
                        wx.BITMAP_TYPE_PNG)
        btn2 = SBitmapTextToggleButton(self.panel, -1, bmp, "Toggle!")
        bmp = wx.Bitmap(os.path.join(bitmapDir, "play.png"),
                        wx.BITMAP_TYPE_PNG)
        btn2.SetBitmapSelected(bmp)
        btn2.Bind(wx.EVT_BUTTON, self.OnTogglePlayStop)

        btn3 = SButton(self.panel, -1, "Rotated")
        btn3.SetButtonColour(wx.Colour("Cyan"))
        btn3.SetLabelColour(wx.WHITE)
        btn3.SetFont(
            wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False))
        btn3.SetAngleOfRotation(90)
        btn3.Bind(wx.EVT_BUTTON, self.OnRotated1)

        btn4 = SButton(self.panel, -1, "Button!")
        btn4.SetAngleOfRotation(45)
        btn4.Bind(wx.EVT_BUTTON, self.OnRotated1)

        btsizer.Add(btn1, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        btsizer.Add(btn2, 1, wx.EXPAND | wx.BOTTOM, 5)
        btsizer.Add(btn3, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        btsizer.Add(btn4, 1, wx.EXPAND)

        btsizer.AddGrowableRow(0)
        btsizer.AddGrowableRow(1)
        btsizer.AddGrowableCol(0)
        btsizer.AddGrowableCol(1)

        return btsizer