예제 #1
0
 def __init__(self, **kwds):
     titles, values = self._extract_initial_items(kwds)
     self._titles = titles
     self._values = values
     frame = ((0, 0), (100, 20))
     ns = PyGUI_NSPopUpButton.alloc().initWithFrame_pullsDown_(frame, False)
     ns.pygui_component = self
     ns_set_action(ns, 'doAction:')
     self._ns_update_items(ns)
     ns_size_to_fit(ns)
     GListButton.__init__(self, _ns_view = ns, **kwds)
 def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
         padding = (0, 0)):
     ns_button = PyGUI_NSButton.alloc().init()
     ns_button.pygui_component = self
     ns_button.setButtonType_(ns_button_type)
     ns_button.setBezelStyle_(ns_bezel_style)
     ns_button.setTitle_(title)
     ns_button.setFont_(font._ns_font)
     num_lines = title.count("\n") + 1
     ns_size_to_fit(ns_button, padding = padding,
         height = font.line_height * num_lines + 5)
     ns_set_action(ns_button, 'doAction:')
     return ns_button
예제 #3
0
	def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
			padding = (0, 0)):
		ns_button = PyGUI_NSButton.alloc().init()
		ns_button.pygui_component = self
		ns_button.setButtonType_(ns_button_type)
		ns_button.setBezelStyle_(ns_bezel_style)
		ns_button.setTitle_(title)
		ns_button.setFont_(font._ns_font)
		num_lines = title.count("\n") + 1
		ns_size_to_fit(ns_button, padding = padding,
			height = font.line_height * num_lines + 5)
		ns_set_action(ns_button, 'doAction:')
		return ns_button
예제 #4
0
파일: Slider.py 프로젝트: mnabeelp/PyGUI
 def __init__(self, orient='h', ticks=0, **kwds):
     length = 100
     if ticks:
         breadth = 30
     else:
         breadth = 22  # Same as default height of a text-containing control
     if orient == 'h':
         ns_frame = ((0, 0), (length, breadth))
     elif orient == 'v':
         ns_frame = ((0, 0), (breadth, length))
     else:
         raise ValueError("Invalid orientation, should be 'h' or 'v'")
     ns_slider = PyGUI_NSSlider.alloc().initWithFrame_(ns_frame)
     ns_slider.pygui_component = self
     ns_set_action(ns_slider, 'doAction:')
     GSlider.__init__(self, _ns_view=ns_slider, **kwds)
     self.set_ticks(ticks)
     self._last_value = None
예제 #5
0
 def __init__(self, orient = 'h', ticks = 0, **kwds):
     length = 100
     if ticks:
         breadth = 30
     else:
         breadth = 22 # Same as default height of a text-containing control
     if orient == 'h':
         ns_frame = ((0, 0), (length, breadth))
     elif orient == 'v':
         ns_frame = ((0, 0), (breadth, length))
     else:
         raise ValueError("Invalid orientation, should be 'h' or 'v'")
     ns_slider = PyGUI_NSSlider.alloc().initWithFrame_(ns_frame)
     ns_slider.pygui_component = self
     ns_set_action(ns_slider, 'doAction:')
     GSlider.__init__(self, _ns_view = ns_slider, **kwds)
     self.set_ticks(ticks)
     self._last_value = None