• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python widget.Widget类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中widget.Widget的典型用法代码示例。如果您正苦于以下问题:Python Widget类的具体用法?Python Widget怎么用?Python Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Widget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: refresh

 def refresh(self):
     """
     Redraw border for EditBox and command an underlying window refresh.
     """
     if self.__border:
         rectangle(self.window, self.y-1, self.x-1, self.y+1, self.x+self.cols)
     Widget.refresh(self)
开发者ID:msmiley,项目名称:pycurseslib,代码行数:7,代码来源:editbox.py


示例2: _update_state

    def _update_state(self):
        ''' Update state. '''

        if self._deleted:
            return
        Widget._update_state(self)
        self._label.color = self._style.colors[self._state]
开发者ID:Merfie,项目名称:Space-Train,代码行数:7,代码来源:label.py


示例3: __init__

 def __init__(self, rows, row_spacing = 10, column_spacing = 10, **kwds):
     col_widths = [0] * len(rows[0])
     row_heights = [0] * len(rows)
     for j, row in enumerate(rows):
         for i, widget in enumerate(row):
             if widget:
                 col_widths[i] = max(col_widths[i], widget.width)
                 row_heights[j] = max(row_heights[j], widget.height)
     row_top = 0
     for j, row in enumerate(rows):
         h = row_heights[j]
         y = row_top + h // 2
         col_left = 0
         for i, widget in enumerate(row):
             if widget:
                 w = col_widths[i]
                 x = col_left
                 widget.midleft = (x, y)
             col_left += w + column_spacing
         row_top += h + row_spacing
     width = max(1, col_left - column_spacing)
     height = max(1, row_top - row_spacing)
     r = Rect(0, 0, width, height)
     #print "albow.controls.Grid: r =", r ###
     #print "...col_widths =", col_widths ###
     #print "...row_heights =", row_heights ###
     Widget.__init__(self, r, **kwds)
     self.add(rows)
开发者ID:codewarrior0,项目名称:mcedit,代码行数:28,代码来源:layout.py


示例4: __init__

	def __init__(self, surface):
		global root_widget
		Widget.__init__(self, surface.get_rect())
		self.surface = surface
		root_widget = self
		widget.root_widget = self
		self.is_gl = surface.get_flags() & OPENGL <> 0
开发者ID:AnnanFay,项目名称:pyge-solitaire,代码行数:7,代码来源:root.py


示例5: __init__

 def __init__(self, surface):
     global root_widget
     Widget.__init__(self, surface.get_rect())
     self.surface = surface
     root_widget = self
     widget.root_widget = self
     self.is_gl = surface.get_flags() & OPENGL != 0
     self.idle_handlers = []
     self.dont = False
     self.shiftClicked = 0
     self.shiftPlaced = -2
     self.ctrlClicked = 0
     self.ctrlPlaced = -2
     self.altClicked = 0
     self.altPlaced = -2
     self.shiftAction = None
     self.altAction = None
     self.ctrlAction = None
     self.editor = None
     self.selectTool = None
     self.movementMath = [-1, 1, 1, -1, 1, -1]
     self.movementNum = [0, 0, 2, 2, 1, 1]
     self.notMove = [False, False, False, False, False, False]
     self.usedKeys = [False, False, False, False, False, False]
     self.cameraMath = [-1., 1., -1., 1.]
     self.cameraNum = [0, 0, 1, 1]
     self.notMoveCamera = [False, False, False, False]
     self.usedCameraKeys = [False, False, False, False]
开发者ID:Dominic001,项目名称:MCEdit-Unified,代码行数:28,代码来源:root.py


示例6: on_mouse_scroll

	def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
		Widget.on_mouse_scroll(self, x, y, scroll_x, scroll_y)
		
		r = self.clip_rect()
		for c in self.children:
			if r.intersect(c.bounds()).hit_test(x, y):
				c.on_mouse_scroll(x, y, scroll_x, scroll_y)
开发者ID:Elizabwth,项目名称:pyman,代码行数:7,代码来源:container.py


示例7: __init__

 def __init__(self, id, parent):
   Widget.__init__(self, id, parent)
   self._add_widget('histogram_table', HistogramTable)
   self._add_widget('population_picker', PopulationPicker)
   self._add_widget('dim_picker', Select)
   self._add_widget('negative_values_picker', Select)
   self._add_widget('apply', ApplyButton)
开发者ID:ericjsolis,项目名称:danapeerlab,代码行数:7,代码来源:histogram_report.py


示例8: load_widget

    def load_widget(self, name, x=None, y=None):
        """
        Load a widget with the given name at the specified coordinates (optional).

        :param name: The name of the widget.
        :param x: The x-coordinate.
        :param y: The y-coordinate.

        :type name: `str`
        :type x: `int`
        :type y: `int`
        """

        x, y = int(x), int(y)

        self.messages.debug("Loading widget '%s'..." % name)

        # Initialize the widget...
        widget = Widget(self.available_widgets.get_by_name(name)._path, backref=self)

        widget.set_position(x, y)

        # Add the widget to the list of currently active widgets:
        self.widgets.add(widget, x, y)

        widget.show()
开发者ID:sbillaudelle,项目名称:melange,代码行数:26,代码来源:melange.py


示例9: __init__

    def __init__(self, x=0, y=0, z=0, width=200, height=10,
                 font_size = 10, anchor_x='left', anchor_y='bottom',
                 value=0.50):

        Widget.__init__(self,x,y,z,width,height,anchor_x,anchor_y)

        fg = (1,1,1,1)
        bg = (1,1,1,.5)

        frame = Rectangle (x=0, y=0, z=z,
                           width=width, height=height, radius=(height-1)/2,
                           foreground=fg, background=bg,
                           anchor_x=anchor_x, anchor_y=anchor_y)
        cursor = Ellipse (x=0, y=-.5+height/2, z=z,
                          width=height-1, height=height-1,
                          foreground=fg, background=fg,
                          anchor_x='center', anchor_y='center')
        label = pyglet.text.Label('0',
                                  font_name='Monaco',
                                  font_size=8,
                                  x=0, y=height+2,
                                  anchor_x='center', anchor_y='bottom')
        self._elements['frame'] = frame
        self._elements['cursor'] = cursor
        self._elements['label'] = label
        self.set_cursor(value)
        self._is_dragging = False
开发者ID:Sankluj,项目名称:PyWidget,代码行数:27,代码来源:slider.py


示例10: __init__

    def __init__(self, x=0, y=0, z=0, width=300, height=300, anchor_x='left',
                 anchor_y='bottom', elements=[]):

        fg = (.5,.5,.5, 1)
        bg = (.5,.5,.5,.5)
        Widget.__init__(self,x,y,z,width,height,anchor_x,anchor_y)

        self.margin = 3
        self.ropen = 0
        length = len(elements)
        for i in range(length):
            elements[i].height = height / length - 2 * self.margin
            elements[i].width = width - 2 * self.margin
            elements[i].x = self.margin
            elements[i].y = (height - self.margin) - (i + 2) * (elements[i].height + self.margin)
            self._elements[i] = elements[i]
            self._elements[i]._hidden = True

        chooselabel = Label(text='...',
                            x=self.margin, y= (height - self.margin) - (
                            elements[i].height + self.margin),
                            height = height / length - 2 * self.margin,
                            width = width - 2 * self.margin)

        frame = Rectangle (x=chooselabel.x, y=chooselabel.y + chooselabel.height, z=z,
                           width=chooselabel.width, height=-chooselabel.height, radius=0,
                           foreground=fg, background=bg,
                           anchor_x=anchor_x, anchor_y=anchor_y)

        self._elements['chooselabel'] = chooselabel
        self._elements['frame'] = frame
开发者ID:Sankluj,项目名称:PyWidget,代码行数:31,代码来源:radiobutton.py


示例11: __init__

 def __init__(self, items, keysColumn=None, buttonsColumn=None, item_spacing=None):
     self.items = items
     self.item_spacing = item_spacing
     self.keysColumn = keysColumn
     self.buttonsColumn = buttonsColumn
     Widget.__init__(self)
     self.buildWidgets()
开发者ID:Nerocat,项目名称:MCEdit-Unified,代码行数:7,代码来源:extended_widgets.py


示例12: _move

 def _move(self, x, y):
     dx, dy = x - self.x, y - self.y
     Widget._move(self, x, y)
     widget = self._label or self._layout
     if widget:
         widget.x = widget.x + dx
         widget.y = widget.y + dy
开发者ID:obspy,项目名称:branches,代码行数:7,代码来源:entry.py


示例13: setFocusHandler

 def setFocusHandler(self,focusHandler):
     Widget.setFocusHandler(self,focusHandler)
     if self.mInternalFocusHandler != None:
         return None
     
     for i in self.mWidgets:
         i.setFocusHandler(focusHandler)
开发者ID:rolph-recto,项目名称:Guichan,代码行数:7,代码来源:basicContainer.py


示例14: setInternalFocusHandler

 def setInternalFocusHandler(self,focusHandler):
     Widget.setInternalFocusHandler(self,focusHandler)
     for i in self.mWidgets:
         if self.mInternalFocusHandler == None:
             i.setFocusHandler(self.getFocusHandler())
         else:
             i.setFocusHandler(self.mInternalFocusHandler)
开发者ID:rolph-recto,项目名称:Guichan,代码行数:7,代码来源:basicContainer.py


示例15: addSettings

    def addSettings(klass, s):
        '''Construct list of settings.'''
        Widget.addSettings(s)

        s.add( setting.Distance( 'leftMargin',
                                 '1.7cm',
                                 descr=_('Distance from left of graph to edge'),
                                 usertext=_('Left margin'),
                                 formatting=True) )
        s.add( setting.Distance( 'rightMargin',
                                 '0.2cm',
                                 descr=_('Distance from right of graph to edge'),
                                 usertext=_('Right margin'),
                                 formatting=True) )
        s.add( setting.Distance( 'topMargin',
                                 '0.2cm',
                                 descr=_('Distance from top of graph to edge'),
                                 usertext=_('Top margin'),
                                 formatting=True) )
        s.add( setting.Distance( 'bottomMargin',
                                 '1.7cm',
                                 descr=_('Distance from bottom of graph to edge'),
                                 usertext=_('Bottom margin'),
                                 formatting=True) )
        s.add( setting.GraphBrush( 'Background',
                                   descr = _('Background plot fill'),
                                   usertext=_('Background')),
               pixmap='settings_bgfill' )
        s.add( setting.Line('Border', descr = _('Graph border line'),
                            usertext=_('Border')),
               pixmap='settings_border')
开发者ID:JoonyLi,项目名称:veusz,代码行数:31,代码来源:nonorthgraph.py


示例16: update_elements

	def update_elements(self):
		if self._dirty and self.theme:
			patch = self.theme['button'][('image_down' if self._down else 'image_up')]
						
			label = self.elements['label']
			
			font = label.document.get_font()
			height = font.ascent - font.descent
			
			left = 0
			if self.halign == 'center':
				left = self.w/2 - self._pref_size[0]/2
			elif self.halign == 'right':
				left = self.w - self._pref_size[0]
			
			bottom = 0
			if self.valign == 'center':
				bottom = self.h/2 - self._pref_size[1]/2
			elif self.valign == 'top':
				bottom = self.h - self._pref_size[1]
			
			label.x = self._gx + left + patch.padding_left
			label.y = self._gy + bottom + patch.padding_bottom
			
			self.shapes['frame'].update(self._gx + left + patch.padding_left, self._gy + bottom + patch.padding_bottom, label.content_width, height)
			
			self.active_region = Rect(self._gx + left + patch.padding_left, self._gy + bottom + patch.padding_bottom, label.content_width, height)
		
		Widget.update_elements(self)
开发者ID:arokem,项目名称:Fos,代码行数:29,代码来源:button.py


示例17: on_mouse_release

	def on_mouse_release(self, x, y, button, modifiers):
		Widget.on_mouse_release(self, x, y, button, modifiers)
		
		r = self.clip_rect()
		for c in self.children:
			if r.intersect(c.bounds()).hit_test(x, y):
				c.on_mouse_release(x, y, button, modifiers)
开发者ID:Elizabwth,项目名称:pyman,代码行数:7,代码来源:container.py


示例18: __init__

    def __init__(self, parent, name=None):
        '''Initialise plotter.'''
        Widget.__init__(self, parent, name=name)
        if type(self) == NonOrthFunction:
            self.readDefaults()

        self.checker = FunctionChecker()
开发者ID:JoonyLi,项目名称:veusz,代码行数:7,代码来源:nonorthfunction.py


示例19: testSize

 def testSize(self):
     expectedSize = (40,40)
     widget = Widget()
     if widget.getSize() == expectedSize:
         print "test[Widget}: getSize workds perfect!"
     else:
         print "test:Widget] getSize does not work!"
开发者ID:EverydayQA,项目名称:prima,代码行数:7,代码来源:none_xunit.py


示例20: on_mouse_drag

	def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
		if self._focused:
			self.label.caret.on_mouse_drag(x, y, dx, dy, button, modifiers)
			return pyglet.event.EVENT_HANDLED
				
		Widget.on_mouse_drag(self, x, y, dx, dy, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:irskep,项目名称:Aerthian,代码行数:7,代码来源:text_input.py



注:本文中的widget.Widget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python screen.Screen类代码示例发布时间:2022-05-26
下一篇:
Python widget.add_onsite_js_files函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap