当前位置: 首页>>代码示例>>Python>>正文


Python Label.setWidth方法代码示例

本文整理汇总了Python中muntjac.api.Label.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Python Label.setWidth方法的具体用法?Python Label.setWidth怎么用?Python Label.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在muntjac.api.Label的用法示例。


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

示例1: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(WebLayoutWindow, self).__init__()

        # Our main layout is a horizontal layout
        main = HorizontalLayout()
        main.setMargin(True)
        main.setSpacing(True)
        self.setContent(main)

        # Tree to the left
        tree = Tree()
        tree.setContainerDataSource( ExampleUtil.getHardwareContainer() )
        tree.setItemCaptionPropertyId( ExampleUtil.hw_PROPERTY_NAME )
        for idd in tree.rootItemIds():
            tree.expandItemsRecursively(idd)
        self.addComponent(tree)

        # vertically divide the right area
        left = VerticalLayout()
        left.setSpacing(True)
        self.addComponent(left)

        # table on top
        tbl = Table()
        tbl.setWidth('500px')
        tbl.setContainerDataSource( ExampleUtil.getISO3166Container() )
        tbl.setSortDisabled(True)
        tbl.setPageLength(7)
        left.addComponent(tbl)

        # Label on bottom
        text = Label(ExampleUtil.lorem, Label.CONTENT_XHTML)
        text.setWidth('500px')  # some limit is good for text
        left.addComponent(text)
开发者ID:AvdN,项目名称:muntjac,代码行数:36,代码来源:WebLayoutExample.py

示例2: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(PopupViewContentsExample, self).__init__()

        self.setSpacing(True)

        # ------
        # Static content for the minimized view
        # ------

        # Create the content for the popup
        content = Label('This is a simple Label component inside the popup. '
                'You can place any Muntjac components here.')

        # The PopupView popup will be as large as needed by the content
        content.setWidth('300px')

        # Construct the PopupView with simple HTML text representing the
        # minimized view
        popup = PopupView('Static HTML content', content)
        self.addComponent(popup)

        # ------
        # Dynamic content for the minimized view
        # ------

        # In this sample we update the minimized view value with the content of
        # the TextField inside the popup.
        popup = PopupView( PopupTextField() )
        popup.setDescription('Click to edit')
        popup.setHideOnMouseOut(False)
        self.addComponent(popup)
开发者ID:AvdN,项目名称:muntjac,代码行数:33,代码来源:PopupViewContentsExample.py

示例3: createComponents

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def createComponents(self):
        components = list()

        label = Label('This is a long text block that will wrap.')
        label.setWidth('120px')
        components.append(label)

        image = Embedded('', ThemeResource('../runo/icons/64/document.png'))
        components.append(image)

        documentLayout = CssLayout()
        documentLayout.setWidth('19px')
        for _ in range(5):
            e = Embedded(None, ThemeResource('../runo/icons/16/document.png'))
            e.setHeight('16px')
            e.setWidth('16px')
            documentLayout.addComponent(e)
        components.append(documentLayout)

        buttonLayout = VerticalLayout()
        button = Button('Button')

        button.addListener(ButtonClickListener(self), IClickListener)
        buttonLayout.addComponent(button)
        buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER)
        components.append(buttonLayout)

        return components
开发者ID:AvdN,项目名称:muntjac,代码行数:30,代码来源:DragDropRearrangeComponentsExample.py

示例4: _add_statusbar

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def _add_statusbar ( self ):
        """ Adds a statusbar to the dialog.
        """
        if self.ui.view.statusbar is not None:
            control = HorizontalLayout()
            control.setSizeGripEnabled(self.ui.view.resizable)
            listeners = []
            for item in self.ui.view.statusbar:
                # Create the status widget with initial text
                name = item.name
                item_control = Label()
                item_control.setValue(self.ui.get_extended_value(name))

                # Add the widget to the control with correct size
                width = abs(item.width)
                stretch = 0
                if width <= 1.0:
                    stretch = int(100 * width)
                else:
                    item_control.setWidth('%dpx' % width)
                control.addComponent(item_control)

                # Set up event listener for updating the status text
                col = name.find('.')
                obj = 'object'
                if col >= 0:
                    obj = name[:col]
                    name = name[col+1:]
                obj = self.ui.context[obj]
                set_text = self._set_status_text(item_control)
                obj.on_trait_change(set_text, name, dispatch='ui')
                listeners.append((obj, set_text, name))

            self.control.addComponent(control)
            self.ui._statusbar = listeners
开发者ID:rwl,项目名称:traitsui,代码行数:37,代码来源:ui_base.py

示例5: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(PopupViewClosingExample, self).__init__()

        self.setSpacing(True)

        # Create the content for the popup
        content = Label('This popup will close as soon as you move the '
                'mouse cursor outside of the popup area.')
        # The PopupView popup will be as large as needed by the content
        content.setWidth('300px')
        # Construct the PopupView with simple HTML text representing the
        # minimized view
        popup = PopupView('Default popup', content)
        popup.setHideOnMouseOut(True)
        popup.addListener(self, IPopupVisibilityListener)
        self.addComponent(popup)

        content = Label('This popup will only close if you click '
                'the mouse outside the popup area.')
        # The PopupView popup will be as large as needed by the content
        content.setWidth('300px')
        popup = PopupView('Popup that won\'t auto-close', content)
        popup.setHideOnMouseOut(False)
        popup.addListener(self, IPopupVisibilityListener)
        self.addComponent(popup)
开发者ID:AvdN,项目名称:muntjac,代码行数:27,代码来源:PopupViewClosingExample.py

示例6: init

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def init(self):
#        super(GoogleMapWidgetApp, self).__init__()

        self.setMainWindow(Window('Google Map add-on demo'))

        # Create a new map instance centered on the IT Mill offices
        self._googleMap = GoogleMap(self, (22.3, 60.4522), 8)

        self._googleMap.setWidth('640px')
        self._googleMap.setHeight('480px')

        # Create a marker at the IT Mill offices
        self._mark1 = BasicMarker(1L, (22.3, 60.4522), 'Test marker 1')
        self._mark2 = BasicMarker(2L, (22.4, 60.4522), 'Test marker 2')
        self._mark3 = BasicMarker(4L, (22.6, 60.4522), 'Test marker 3')
        self._mark4 = BasicMarker(5L, (22.7, 60.4522), 'Test marker 4')

        l = MarkerClickListener(self)
        self._googleMap.addListener(l, IMarkerClickListener)

        # Marker with information window pupup
        self._mark5 = BasicMarker(6L, (22.8, 60.4522), 'Marker 5')
        self._mark5.setInfoWindowContent(self._googleMap,
                Label('Hello Marker 5!'))

        content = Label('Hello Marker 2!')
        content.setWidth('60px')
        self._mark2.setInfoWindowContent(self._googleMap, content)

        self._googleMap.addMarker(self._mark1)
        self._googleMap.addMarker(self._mark2)
        self._googleMap.addMarker(self._mark3)
        self._googleMap.addMarker(self._mark4)
        self._googleMap.addMarker(self._mark5)
        self.getMainWindow().getContent().addComponent(self._googleMap)

        # Add a Marker click listener to catch marker click events.
        # Note, works only if marker has information window content
        l = MarkerClickListener2(self)
        self._googleMap.addListener(l, IMarkerClickListener)

        # Add a MarkerMovedListener to catch events when a marker is dragged to
        # a new location
        l = MarkerMovedListener(self)
        self._googleMap.addListener(l, IMarkerMovedListener)

        l = MapMoveListener(self)
        self._googleMap.addListener(l, IMapMoveListener)

        self._googleMap.addControl(MapControl.MapTypeControl)

        self.addTestButtons()  # Add buttons that trigger tests map features
开发者ID:MatiasNAmendola,项目名称:muntjac,代码行数:54,代码来源:google_map_app.py

示例7: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(PackageIconsExample, self).__init__()

        self._icons = ['arrow-down.png', 'arrow-left.png', 'arrow-right.png',
            'arrow-up.png', 'attention.png', 'calendar.png', 'cancel.png',
            'document.png', 'document-add.png', 'document-delete.png',
            'document-doc.png', 'document-image.png', 'document-pdf.png',
            'document-ppt.png', 'document-txt.png', 'document-web.png',
            'document-xsl.png', 'email.png', 'email-reply.png',
            'email-send.png', 'folder.png', 'folder-add.png',
            'folder-delete.png', 'globe.png', 'help.png', 'lock.png',
            'note.png', 'ok.png', 'reload.png', 'settings.png', 'trash.png',
            'trash-full.png', 'user.png', 'users.png']

        self._sizes = ['16', '32', '64']

        self.setSpacing(True)

        tabSheet = TabSheet()
        tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL)

        for size in self._sizes:
            iconsSideBySide = 2 if size == '64' else 3
            grid = GridLayout(iconsSideBySide * 2, 1)
            grid.setSpacing(True)
            grid.setMargin(True)
            tabSheet.addTab(grid, size + 'x' + size, None)

            tabSheet.addComponent(grid)
            for icon in self._icons:
                res = ThemeResource('../runo/icons/' + size + '/' + icon)

                e = Embedded(None, res)

                # Set size to avoid flickering when loading
                e.setWidth(size + 'px')
                e.setHeight(size + 'px')

                name = Label(icon)
                if size == '64':
                    name.setWidth('185px')
                else:
                    name.setWidth('150px')

                grid.addComponent(e)
                grid.addComponent(name)

                grid.setComponentAlignment(name, Alignment.MIDDLE_LEFT)

        self.addComponent(tabSheet)
开发者ID:AvdN,项目名称:muntjac,代码行数:52,代码来源:PackageIconsExample.py

示例8: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(ApplicationLayoutWindow, self).__init__()

        # Our main layout is a horizontal layout
        main = HorizontalLayout()
        main.setSizeFull()
        self.setContent(main)

        # Tree to the left
        treePanel = Panel()  # for scrollbars
        treePanel.setStyleName(Reindeer.PANEL_LIGHT)
        treePanel.setHeight('100%')
        treePanel.setWidth(None)
        treePanel.getContent().setSizeUndefined()
        self.addComponent(treePanel)

        tree = Tree()
        tree.setContainerDataSource(ExampleUtil.getHardwareContainer())
        tree.setItemCaptionPropertyId(ExampleUtil.hw_PROPERTY_NAME)
        for idd in tree.rootItemIds():
            tree.expandItemsRecursively(idd)
        treePanel.addComponent(tree)

        # vertically divide the right area
        left = VerticalLayout()
        left.setSizeFull()
        self.addComponent(left)
        main.setExpandRatio(left, 1.0)  # use all available space

        # table on top
        tbl = Table()
        tbl.setWidth('100%')
        tbl.setContainerDataSource(ExampleUtil.getISO3166Container())
        tbl.setSortDisabled(True)
        tbl.setPageLength(7)
        left.addComponent(tbl)

        # Label on bottom
        textPanel = Panel()  # for scrollbars
        textPanel.setStyleName(Reindeer.PANEL_LIGHT)
        textPanel.setSizeFull()
        left.addComponent(textPanel)
        left.setExpandRatio(textPanel, 1.0)  # use all available space

        text = Label(ExampleUtil.lorem, Label.CONTENT_XHTML)
        text.setWidth('500px')  # some limit is good for text
        textPanel.addComponent(text)
开发者ID:AvdN,项目名称:muntjac,代码行数:49,代码来源:ApplicationLayoutExample.py

示例9: __init__

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def __init__(self):
        super(SliderHorizontalExample, self).__init__()

        self.setSpacing(True)

        self.setWidth('100%')

        value = Label('0')
        value.setWidth('3em')

        slider = Slider('Select a value between 0 and 100')
        slider.setWidth('100%')
        slider.setMin(0)
        slider.setMax(100)
        slider.setImmediate(True)

        slider.addListener(SliderListener(value), IValueChangeListener)

        self.addComponent(slider)
        self.setExpandRatio(slider, 1)
        self.addComponent(value)

        self.setComponentAlignment(value, Alignment.BOTTOM_LEFT)
开发者ID:AvdN,项目名称:muntjac,代码行数:25,代码来源:SliderHorizontalExample.py

示例10: init

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
    def init(self):
        # We'll build the whole UI here, since the application will not
        # contain any logic. Otherwise it would be more practical to
        # separate parts of the UI into different classes and methods.

        # Main (browser) window, needed in all Muntjac applications
        rootLayout = VerticalLayout()
        root = Window('MuntjacTunes', rootLayout)

        # We'll attach the window to the browser view already here, so
        # we won't forget it later.
        self.setMainWindow(root)

        root.showNotification(('This is an example of how you can do layouts '
                'in Muntjac.<br/>It is not a working sound player.'),
                Notification.TYPE_HUMANIZED_MESSAGE)

        # Our root window contains one VerticalLayout, let's make
        # sure it's 100% sized, and remove unwanted margins
        rootLayout.setSizeFull()
        rootLayout.setMargin(False)

        # Top area, containing playback and volume controls, play status,
        # view modes and search
        top = HorizontalLayout()
        top.setWidth('100%')
        top.setMargin(False, True, False, True)  # Enable horizontal margins
        top.setSpacing(True)

        # Let's attach that one straight away too
        root.addComponent(top)

        # Create the placeholders for all the components in the top area
        playback = HorizontalLayout()
        volume = HorizontalLayout()
        status = HorizontalLayout()
        viewmodes = HorizontalLayout()
        search = ComboBox()

        # Add the components and align them properly
        top.addComponent(playback)
        top.addComponent(volume)
        top.addComponent(status)
        top.addComponent(viewmodes)
        top.addComponent(search)
        top.setComponentAlignment(playback, Alignment.MIDDLE_LEFT)
        top.setComponentAlignment(volume, Alignment.MIDDLE_LEFT)
        top.setComponentAlignment(status, Alignment.MIDDLE_CENTER)
        top.setComponentAlignment(viewmodes, Alignment.MIDDLE_LEFT)
        top.setComponentAlignment(search, Alignment.MIDDLE_LEFT)

        # We want our status area to expand if the user resizes the root
        # window, and we want it to accommodate as much space as there is
        # available. All other components in the top layout should stay fixed
        # sized, so we don't need to specify any expand ratios for them (they
        # will automatically revert to zero after the following line).
        top.setExpandRatio(status, 1.0)

        # Playback controls
        prev = NativeButton('Previous')
        play = NativeButton('Play/pause')
        nextt = NativeButton('Next')
        playback.addComponent(prev)
        playback.addComponent(play)
        playback.addComponent(nextt)
        # Set spacing between the buttons
        playback.setSpacing(True)

        # Volume controls
        mute = NativeButton('mute')
        vol = Slider()
        vol.setOrientation(Slider.ORIENTATION_HORIZONTAL)
        vol.setWidth('100px')
        maxx = NativeButton('max')
        volume.addComponent(mute)
        volume.addComponent(vol)
        volume.addComponent(maxx)

        # Status area
        status.setWidth('80%')
        status.setSpacing(True)

        toggleVisualization = NativeButton('Mode')
        timeFromStart = Label('0:00')

        # We'll need another layout to show currently playing track and
        # progress
        trackDetails = VerticalLayout()
        trackDetails.setWidth('100%')
        track = Label('Track Name')
        album = Label('Album Name - Artist')
        track.setWidth(None)
        album.setWidth(None)
        progress = Slider()
        progress.setOrientation(Slider.ORIENTATION_HORIZONTAL)
        progress.setWidth('100%')
        trackDetails.addComponent(track)
        trackDetails.addComponent(album)
        trackDetails.addComponent(progress)
        trackDetails.setComponentAlignment(track, Alignment.TOP_CENTER)
#.........这里部分代码省略.........
开发者ID:MatiasNAmendola,项目名称:muntjac,代码行数:103,代码来源:MuntjacTunesLayout.py

示例11: _add_items

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]

#.........这里部分代码省略.........
                    else:
                        label = heading_text(None, text=label).control

                    self._add_widget(inner, label, row, col, show_labels)

                    if item.emphasized:
                        self._add_emphasis(label)

                # Continue on to the next Item in the list:
                continue

            # Check if it is a separator:
            if name == '_':
                cols = columns

                # See if the layout is a grid.
                if row >= 0:
                    # Move to the start of the next row if necessary.
                    if col > 0:
                        col = 0
                        row += 1

#                    # Skip the row we are about to do.
#                    row += 1

                    # Allow for the columns.
                    if show_labels:
                        cols *= 2

                for i in range(cols):
                    if self.horizontal:
                        # Add a vertical separator:
                        line = Panel()
                        line.setWidth('2px')
                        line.setHeight('-1px')
                        if row < 0:
                            inner.addComponent(line)
                        else:
                            inner.addComponent(line, row, i)
                    else:
                        # Add a horizontal separator:
                        line = Label('<hr />', Label.CONTENT_XHTML)
                        line.setWidth('100%')  # FIXME: explicit container size
                        if row < 0:
                            inner.addComponent(line)
                        else:
                            inner.addComponent(line, i, row)

                # Continue on to the next Item in the list:
                continue

            # Convert a blank to a 5 pixel spacer:
            if name == ' ':
                name = '5'

            # Check if it is a spacer:
            if all_digits.match( name ):

                # If so, add the appropriate amount of space to the layout:
                spacer = Label('')
                if self.horizontal:
                    # Add a horizontal spacer:
                    spacer.setWidth(name + 'px')
                else:
                    # Add a vertical spacer:
                    spacer.setHeight(name + 'px')
开发者ID:rwl,项目名称:traitsui,代码行数:70,代码来源:ui_panel.py

示例12: FeatureView

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
class FeatureView(HorizontalLayout):

    _MSG_SHOW_SRC = 'View Source'

    def __init__(self):
        super(FeatureView, self).__init__()

        self._right = None
        self._left = None
        self._controls = None
        self._title = Label("", Label.CONTENT_XHTML)
        self._showSrc = None
        self._exampleCache = dict()
        self._currentFeature = None
        self._srcWindow = None

        self.setWidth('100%')
        self.setMargin(True)
        self.setSpacing(True)
        self.setStyleName('sample-view')

        self._left = VerticalLayout()
        self._left.setWidth('100%')
        self._left.setSpacing(True)
        self._left.setMargin(False)
        self.addComponent(self._left)
        self.setExpandRatio(self._left, 1)

        rightLayout = VerticalLayout()
        self._right = Panel(rightLayout)
        rightLayout.setMargin(True, False, False, False)
        self._right.setStyleName(Reindeer.PANEL_LIGHT)
        self._right.addStyleName('feature-info')
        self._right.setWidth('319px')
        self.addComponent(self._right)

        self._controls = HorizontalLayout()
        self._controls.setWidth('100%')
        self._controls.setStyleName('feature-controls')

        self._title.setStyleName('title')
        self._controls.addComponent(self._title)
        self._controls.setExpandRatio(self._title, 1)

        resetExample = NativeButton('Reset', ResetListener(self))
        resetExample.setStyleName(BaseTheme.BUTTON_LINK)
        resetExample.addStyleName('reset')
        resetExample.setDescription('Reset Sample')
        self._controls.addComponent(resetExample)
        self._showSrc = ActiveLink()
        self._showSrc.setDescription('Right / middle / ctrl / shift -click for browser window/tab')

        self._showSrc.addListener(ShowSrcListener(self), ILinkActivatedListener)
        self._showSrc.setCaption(self._MSG_SHOW_SRC)
        self._showSrc.addStyleName('showcode')
        self._showSrc.setTargetBorder(Link.TARGET_BORDER_NONE)
        self._controls.addComponent(self._showSrc)


    def showSource(self, source):
        if self._srcWindow is None:
            self._srcWindow = Window('Python source')
            self._srcWindow.getContent().setSizeUndefined()
            self._srcWindow.setWidth('70%')
            self._srcWindow.setHeight('60%')
            self._srcWindow.setPositionX(100)
            self._srcWindow.setPositionY(100)

        self._srcWindow.removeAllComponents()
        self._srcWindow.addComponent( CodeLabel(source) )

        if self._srcWindow.getParent() is None:
            self.getWindow().addWindow(self._srcWindow)


    def resetExample(self):
        if self._currentFeature is not None:
            w = self.getWindow()
            w.removeSubwindows()
            f = self._currentFeature
            self._currentFeature = None
            if f in self._exampleCache:
                del self._exampleCache[f]
            self.setFeature(f)


    def setFeature(self, feature):

        from muntjac.demo.sampler.SamplerApplication import SamplerApplication

        if feature != self._currentFeature:
            self._currentFeature = feature
            self._right.removeAllComponents()
            self._left.removeAllComponents()

            self._left.addComponent(self._controls)
            self._title.setValue('<span>' + feature.getName() + '</span>')
            if feature.getSinceVersion().isNew():
                self._title.addStyleName('new')
            else:
#.........这里部分代码省略.........
开发者ID:Lemoncandy,项目名称:muntjac,代码行数:103,代码来源:FeatureView.py

示例13: SimpleSliderEditor

# 需要导入模块: from muntjac.api import Label [as 别名]
# 或者: from muntjac.api.Label import setWidth [as 别名]
class SimpleSliderEditor ( BaseRangeEditor ):
    """ Simple style of range editor that displays a slider and a text field.

    The user can set a value either by moving the slider or by typing a value
    in the text field.
    """

    #---------------------------------------------------------------------------
    #  Trait definitions:
    #---------------------------------------------------------------------------

    # Low value for the slider range
    low = Any

    # High value for the slider range
    high = Any

    # Formatting string used to format value and labels
    format = Str

    #---------------------------------------------------------------------------
    #  Finishes initializing the editor by creating the underlying toolkit
    #  widget:
    #---------------------------------------------------------------------------

    def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        factory = self.factory
        if not factory.low_name:
            self.low = factory.low

        if not factory.high_name:
            self.high = factory.high

        self.format = factory.format

        self.evaluate = factory.evaluate
        self.sync_value( factory.evaluate_name, 'evaluate', 'from' )

        self.sync_value( factory.low_name,  'low',  'from' )
        self.sync_value( factory.high_name, 'high', 'from' )

        self.control = panel = HorizontalLayout()
        panel.setMargin(False)
        panel.setSizeUndefined()

        fvalue = self.value

        try:
            if not (self.low <= fvalue <= self.high):
                fvalue = self.low
            fvalue_text = self.format % fvalue
        except:
            fvalue_text = ''
            fvalue      = self.low

        ivalue = self._convert_to_slider(fvalue)

        self._label_lo = Label()
        if factory.label_width > 0:
            self._label_lo.setWidth(factory.label_width, 'px')
        panel.addComponent(self._label_lo)
        panel.setComponentAlignment(self._label_lo, Alignment.MIDDLE_RIGHT)

        self.control.slider = slider = Slider()
        slider.setImmediate(True)
        slider.setOrientation(Slider.ORIENTATION_HORIZONTAL)

        slider.setMin(self.low)
        slider.setMax(self.high)

        slider.setValue(ivalue)
        slider.addCallback(self.update_object_on_scroll, ValueChangeEvent)
        panel.addComponent(slider)
        panel.setComponentAlignment(slider, Alignment.MIDDLE_RIGHT)

        self._label_hi = Label()
        panel.addComponent(self._label_hi)
        panel.setComponentAlignment(self._label_hi, Alignment.MIDDLE_RIGHT)
        if factory.label_width > 0:
            self._label_hi.setWidth(factory.label_width, 'px')

        self.control.text = text = TextField()
        text.setValue( str(fvalue_text) )
        text.addCallback(self.update_object_on_enter, BlurEvent)

        # The default size is a bit too big and probably doesn't need to grow.
        z = log10( float(self.high) )
        text.setWidth(z + 1, ISizeable.UNITS_EM)

        panel.addComponent(text)

        low_label = factory.low_label
        if factory.low_name != '':
            low_label = self.format % self.low

        high_label = factory.high_label
        if factory.high_name != '':
#.........这里部分代码省略.........
开发者ID:rwl,项目名称:traitsui,代码行数:103,代码来源:range_editor.py


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