當前位置: 首頁>>代碼示例>>Python>>正文


Python Box.Box類代碼示例

本文整理匯總了Python中Box.Box的典型用法代碼示例。如果您正苦於以下問題:Python Box類的具體用法?Python Box怎麽用?Python Box使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Box類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

    def __init__ (self, key, options, _props={}):
        Box.__init__ (self)

        self.props    = _props.copy()
        self._options = options

        if not 'id' in self.props:
            self.id = 'RadioGroup_%s' %(self.uniq_id)

        cfg_value = cfg.get_val (key)

        for o in options:
            val, desc = o

            new_props = {}
            new_props['name']  = key
            new_props['value'] = val

            # Initial value
            if cfg_value != None and \
               cfg_value == val:
                new_props['checked'] = 1

            elif 'checked' in self.props:
                if self.props['checked'] == val:
                    new_props['checked'] = 1

            self += RadioText (desc, new_props)
開發者ID:BeQ,項目名稱:webserver,代碼行數:28,代碼來源:Radio.py

示例2: loadBlenderProperties

 def loadBlenderProperties(self, object):
     Box.loadBlenderProperties(self, object)
     try:
         self.border = object.getProperty('border').getData()
     except AttributeError:
         # No property, set default
         self.border = 1.0
開發者ID:mvanderkolff,項目名稱:navi-misc,代碼行數:7,代碼來源:Teleporter.py

示例3: render

  def render(self, frame, **kwargs):
    box = kwargs.get('box', None)
    live = kwargs.get('live', None)
    tot_votes = kwargs.get('tot_votes', 1)
    tot_votes = max(tot_votes, 1)

    thickness = 6
    if live:
      # red   = min(4*self.votes/tot_votes, 255)
      red   = min(255*self.votes/tot_votes, 255)
      green = 0
      blue  = 0
    else:
      red   = 0
      green = 0
      blue  = 0   

    if box:
      if live: cv2.rectangle(frame, (box.left+thickness/2,box.top+thickness/2), (box.right-thickness/2, box.bottom-thickness/2), (blue, green, red), thickness)
      image_box = Box(0,0,self.mask.shape[0], self.mask.shape[1])
      [image_box, frame_box] = image_box.intersect(box)
      frame[frame_box.top:frame_box.bottom, frame_box.left:frame_box.right] \
        *= self.mask[image_box.top:image_box.bottom, image_box.left:image_box.right] 
      frame[frame_box.top:frame_box.bottom, frame_box.left:frame_box.right] \
        += self.image[image_box.top:image_box.bottom, image_box.left:image_box.right] 

    else:
      if live: cv2.rectangle(frame, (self.box.left+thickness/2,self.box.top+thickness/2), (self.box.right-thickness/2, self.box.bottom-thickness/2), (blue, green, red), thickness)
      image_box = Box(0,0,self.mask.shape[0], self.mask.shape[1])
      [image_box, frame_box] = image_box.intersect(self.box)
      frame[frame_box.top:frame_box.bottom, frame_box.left:frame_box.right] \
        *= self.mask[image_box.top:image_box.bottom, image_box.left:image_box.right]
      frame[frame_box.top:frame_box.bottom, frame_box.left:frame_box.right] \
        += self.image[image_box.top:image_box.bottom, image_box.left:image_box.right]
開發者ID:janmtl,項目名稱:cameraplaysemulator,代碼行數:34,代碼來源:Button.py

示例4: __init__

    def __init__ (self, title, widget, comment, props_={}):
        self.title   = title
        self.widget  = widget
        self.comment = comment

        # Properties
        props = props_.copy()

        if 'id' in props:
            self.id = props.pop('id')

        if 'class' in props:
            props['class'] += ' entry'
        else:
            props['class'] = 'entry'

        # Constructor
        Box.__init__ (self, props)

        # Compose
        self += Box ({'class': 'title'}, RawHTML(self.title))

        if self.widget:
            self += Box ({'class': 'widget'}, widget)
        else:
            self += Box ({'class': 'widget'}, Container())

        if isinstance(comment, Widget):
            self += Box ({'class': 'comment'}, comment)
        else:
            self += Box ({'class': 'comment'}, RawHTML(comment))

        self += RawHTML('<div class="after"></div>')
開發者ID:304471720,項目名稱:webserver,代碼行數:33,代碼來源:PropsTable.py

示例5: __init__

 def __init__(self,data=None,pos=None,size=None,fontsize=14,colorbg=COLORS['white'],colorfg=COLORS['tablelight']):
     self.data=data
     self.pos=pos
     self.size=[-1,-1]
     self.fontsize=fontsize
     self.colorbg=colorbg
     self.colorfg=colorfg
     self.alpha=1000
     self.updated=False
     self.centeredx=False
     self.centeredy=True
     self.font=FONTS[self.fontsize]
     if size==None:
         self.size[0]=125
         self.size[1]=int(5*self.fontsize*len(self.data)/4+len(self.data))
     else:
         if size[0]>0:
             self.size[0]=size[0]
         else:
             self.size[0]=125
         if size[1]>0:
             self.size[1]=size[1]
         else:
             self.size[1]=int(5*self.fontsize*len(self.data)/4+len(self.data))
     Box.__init__(self,self.size,pos,self.colorbg)
     self.surf.set_alpha(self.alpha)
     if data:
         self.update(data)
開發者ID:baltzell,項目名稱:Bridget,代碼行數:28,代碼來源:TextBox.py

示例6: __init__

 def __init__(self, text, font, color, width, padding=2.0, justify=solidfuel.constants.CENTER):
     VBox.__init__(self, padding=padding, justify=justify)
     final_lines = self._splitlines(text, font, width)
     for x in final_lines:
         if len(x):
             self.addChild(Text(font, x, color))
         else:
             s = Box()
             s.h = font.get_height()
             self.addChild(s)
     self.pack()
開發者ID:nbudin,項目名稱:solidfuel,代碼行數:11,代碼來源:TextWrapper.py

示例7: __init__

    def __init__ (self, _props={}):
        # Properties
        props = _props.copy()
        if 'class' in props:
            props['class'] += ' druid-button-panel'
        else:
            props['class'] = 'druid-button-panel'

        # Parent's constructor
        Box.__init__ (self, props)
        self.buttons = []
開發者ID:manolodd,項目名稱:activae,代碼行數:11,代碼來源:Druid.py

示例8: __init__

 def __init__(self,screen):
     self.dx=45
     self.dy=25
     self.colorfg=COLORS['black']
     self.font=FONTS[12]
     screct=screen.get_rect()
     self.maxrows=8
     self.size=[self.dx*DECKDEFS.nseats,self.dy*self.maxrows]
     self.pos=(screct.right-DECKDEFS.cardsize[0]-self.size[0]-10,screct.centery-90)
     Box.__init__(self,self.size,self.pos,COLORS['white'])
     self.visible=False
     self.drawHeaders(screen)
開發者ID:baltzell,項目名稱:Bridget,代碼行數:12,代碼來源:BiddingHistoryBox.py

示例9: __init__

	def __init__(self, image):
		Box.__init__(self)
		Visible.__init__(self)
		if issubclass(image.__class__, Image):
			self.w = image.w
			self.h = image.h
			self.nativeW = image.nativeW
			self.nativeH = image.nativeH
			self._texture = image._texture
		elif issubclass(image.__class__, pygame.Surface):
		    self._texture = None
			Image.initFromSurface(self, image)
開發者ID:nbudin,項目名稱:solidfuel,代碼行數:12,代碼來源:Sprite.py

示例10: __init__

    def __init__ (self, _props={}):
        # Properties
        props = _props.copy()
        if 'class' in props:
            props['class'] += ' ui-dialog-buttonpane'
        else:
            props['class'] = 'ui-dialog-buttonpane'

        props['class'] += ' ui-widget-content ui-helper-clearfix'

        # Parent's constructor
        Box.__init__ (self, props)
        self.buttons = []
開發者ID:chetan,項目名稱:cherokee,代碼行數:13,代碼來源:Druid.py

示例11: __init__

    def __init__ (self, props_={}):
        props = props_.copy()
        if 'class' in props:
            props['class'] += " carousel"
        else:
            props['class'] = "carousel"

        Box.__init__ (self, props.copy())
        self.images   = List ({'class': 'overview'})
        self.pager    = List ({'class': 'pager'})
        self.controls = None

        Box.__iadd__ (self, self.images)
開發者ID:BeQ,項目名稱:webserver,代碼行數:13,代碼來源:Carousel.py

示例12: __init__

	def __init__(self):
		Box.__init__(self)
		Visible.__init__(self)
		self.fillColor = (0.0, 0.0, 0.0)
		self.borderColor = (1.0, 1.0, 1.0)
		self.borderWidth = 1.0
		self.rotX = 0.0
		self.rotY = 0.0
		self.rotZ = 0.0
		self.borderOpacity = 1.0
		self.fillOpacity = 1.0
		if Rectangle.fillDisplayList is None:
			self._genDisplayLists()
開發者ID:nbudin,項目名稱:solidfuel,代碼行數:13,代碼來源:Rect.py

示例13: __init__

    def __init__ (self, url, props={}):
        Box.__init__ (self)
        self.url = url
        self.id  = "downloader_%d" %(self.uniq_id)

        # Other GUI components
        self.progressbar = ProgressBar()
        self += self.progressbar

        # Register the uploader path
        self._url_local = "/downloader_%d_report" %(self.uniq_id)
        publish (self._url_local, DownloadReport, url=url)

        download = DownloadEntry_Factory (self.url)
開發者ID:felipebuarque,項目名稱:PL-Stats,代碼行數:14,代碼來源:Downloader.py

示例14: __init__

    def __init__ (self, props={}):
        Box.__init__ (self, {'class': 'star-rating'})

        assert type(props) == dict
        self.selected = props.get('selected', '5')
        self.can_set  = props.pop('can_set', False)

        if 'style' in props:
            props['style'] += ' display:none;'
        else:
            props['style'] = 'display:none;'

        combo = Combobox (props.copy(), RATING_OPTIONS)
        self += combo
開發者ID:304471720,項目名稱:webserver,代碼行數:14,代碼來源:StarRating.py

示例15: __init__

class Page:
    def __init__(self, filename):
        self.bb = Box((0,0),(0,0))
        self.words = []
        self.read_from(filename)
    def add_word(self, wordbox):
        self.words.append(wordbox)
        self.bb.join_with(wordbox)
    def read_from(self, filename):
        #print('reading [%s]...' % filename); stdout.flush()
        with open(filename) as f:
            getnum = lambda match, label: float(match.group(label))
            data = [(getnum(m,'vpos'),getnum(m,'hpos'),
                     getnum(m,'height'),getnum(m,'width')) for m in p.finditer(f.read())]
            for y,x,h,w in data:
               self.add_word(Box([y,x],[y+h,x+w]))
開發者ID:samueltenka,項目名稱:Klustering_Playground,代碼行數:16,代碼來源:Page.py


注:本文中的Box.Box類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。