Example #1
0
 def __init__(self, title = "New Button", font = system_font, **kwds):
     ns_button = self._create_ns_button(title = title, font = font,
         ns_button_type = AppKit.NSMomentaryLight,
         ns_bezel_style = AppKit.NSRoundedBezelStyle,
         padding = (10, 2)
     )
     GButton.__init__(self, _ns_view = ns_button, **kwds)
Example #2
0
 def __init__(
         self,
         title="Button",  #style = 'normal',
         font=system_font,
         **kwds):
     gtk_label = Gtk.Label(label=title)
     gtk_box = Gtk.HBox(spacing=_gtk_icon_spacing)
     gtk_box.pack_end(gtk_label, True, True, 0)
     gtk_alignment = Gtk.Alignment.new(0.5, 0.5, 0.0, 0.0)
     hp = _gtk_extra_hpad
     gtk_alignment.set_padding(0, 0, hp, hp)
     gtk_alignment.add(gtk_box)
     gtk_button = Gtk.Button()
     gtk_button.add(gtk_alignment)
     gtk_button.set_focus_on_click(False)
     gtk_button.show_all()
     w, h = font.text_size(title)
     w2 = w + 2 * _gtk_button_hpad + _gtk_icon_width + _gtk_icon_spacing
     h2 = max(h + 2 * _gtk_button_vpad, _gtk_default_button_height)
     gtk_button.set_size_request(w2, h2)
     self._gtk_box = gtk_box
     self._gtk_alignment = gtk_alignment
     self._gtk_connect(gtk_button, 'clicked', self._gtk_clicked_signal)
     GButton.__init__(self,
                      _gtk_outer=gtk_button,
                      _gtk_title=gtk_label,
                      font=font,
                      **kwds)
Example #3
0
 def __init__(self, title = "New Button", font = system_font, **kwds):
     ns_button = self._create_ns_button(title = title, font = font,
         ns_button_type = AppKit.NSMomentaryLight,
         ns_bezel_style = AppKit.NSRoundedBezelStyle,
         padding = (10, 2)
     )
     GButton.__init__(self, _ns_view = ns_button, **kwds)
 def __init__(self, title = "New Button", **kwds):
     font = self._win_predict_font(kwds)
     style = kwds.pop('style', 'normal')
     self._style = style
     w = font.width(title) + win_hpad
     h = self._calc_height(font)
     win = self._win_create_button(title, win_style(style), w, h)
     GButton.__init__(self, _win = win, **kwds)
Example #5
0
 def __init__(self, title="New Button", **kwds):
     font = self._win_predict_font(kwds)
     style = kwds.pop('style', 'normal')
     self._style = style
     w = font.width(title) + win_hpad
     h = self._calc_height(font)
     win = self._win_create_button(title, win_style(style), w, h)
     GButton.__init__(self, _win=win, **kwds)
Example #6
0
 def __init__(self, title = "Button", #style = 'normal',
         font = system_font, **kwds):
     gtk_label = Gtk.Label(label=title)
     gtk_box = Gtk.HBox(spacing = _gtk_icon_spacing)
     gtk_box.pack_end(gtk_label, True, True, 0)
     gtk_alignment = Gtk.Alignment.new(0.5, 0.5, 0.0, 0.0)
     hp = _gtk_extra_hpad
     gtk_alignment.set_padding(0, 0, hp, hp)
     gtk_alignment.add(gtk_box)
     gtk_button = Gtk.Button()
     gtk_button.add(gtk_alignment)
     gtk_button.set_focus_on_click(False)
     gtk_button.show_all()
     w, h = font.text_size(title)
     w2 = w + 2 * _gtk_button_hpad + _gtk_icon_width + _gtk_icon_spacing
     h2 = max(h + 2 * _gtk_button_vpad, _gtk_default_button_height)
     gtk_button.set_size_request(w2, h2)
     self._gtk_box = gtk_box
     self._gtk_alignment = gtk_alignment
     self._gtk_connect(gtk_button, 'clicked', self._gtk_clicked_signal)
     GButton.__init__(self, _gtk_outer = gtk_button, _gtk_title = gtk_label,
         font = font, **kwds)