1

I'm trying to scale a RadioButton widget to the size of the window; with the code below, I get something like this:

testanim.gif

The button didn't look scaled to me at first - the only way I could determine that it is, in fact, scaled, is through a mouseover (hence the animated .gif).

However, what I'd like to do is actually scale the circle(s) forming the radio button to the extent of the window (and have them react on mouse events same as the above example would); as a mock-up, it would look like this:

test2.png

Is that possible to do with wx.RadioButton?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import wx

class MyFrame1(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame1.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.button_1 = wx.RadioButton(self, -1, "")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: MyFrame1.__set_properties
        self.SetTitle("frame_2")
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: MyFrame1.__do_layout
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.GridSizer(1, 1, 0, 0)
        sizer_3.Add(self.button_1, 0, wx.EXPAND, 0)
        sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_2)
        sizer_2.Fit(self)
        self.SetSize((200,200))
        self.Layout()
        # end wxGlade

# end of class MyFrame1

if __name__ == "__main__":
    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    frame_2 = MyFrame1(None, -1, "")
    app.SetTopWindow(frame_2)
    frame_2.Show()
    app.MainLoop()
sdaau
  • 36,975
  • 46
  • 198
  • 278

0 Answers0