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


Python OwnButton.bind方法代码示例

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


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

示例1: update

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def update(self):
     self.materialLayout.remove_widget(self.btnMaterialEditor)
     btn_material_A = OwnButton(text=self.allMaterials.allMaterials[-1].name)
     btn_material_A.height = self.h
     btn_material_A.bind(on_press=self.show_material_information)
     self.materialLayout.add_widget(btn_material_A)
     self.materialLayout.add_widget(self.btnMaterialEditor)
开发者ID:simbtrix,项目名称:screenmix,代码行数:9,代码来源:editor.py

示例2: create_material_information

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_material_information(self):
     # create the btns to edit the values or the name
     self.btnName, self.btnPrice = OwnButton(), OwnButton()
     self.btnDensity, self.btnStiffness = OwnButton(), OwnButton()
     self.btnStrenght = OwnButton()
     # bind the values to the methods show_numpad and show_keyboard
     self.btnName.bind(on_press=self.show_keyboard)
     self.btnPrice.bind(on_press=self.show_numpad)
     self.btnDensity.bind(on_press=self.show_numpad)
     self.btnStiffness.bind(on_press=self.show_numpad)
     self.btnStrenght.bind(on_press=self.show_numpad)
     # fill the contentLayout with the components
     self.contentLayout = GridLayout(cols=2, row_force_default=True,
                                 row_default_height=Design.btnHeight,
                                 height=Design.btnHeight,
                                 spacing=Design.spacing)
     self.contentLayout.add_widget(OwnLabel(text=self.nameStr))
     self.contentLayout.add_widget(self.btnName)
     self.contentLayout.add_widget(OwnLabel(text=self.priceStr))
     self.contentLayout.add_widget(self.btnPrice)
     self.contentLayout.add_widget(OwnLabel(text=self.densityStr))
     self.contentLayout.add_widget(self.btnDensity)
     self.contentLayout.add_widget(OwnLabel(text=self.stiffnessStr))
     self.contentLayout.add_widget(self.btnStiffness)
     self.contentLayout.add_widget(OwnLabel(text=self.strengthStr))
     self.contentLayout.add_widget(self.btnStrenght)
     # btn_back=go back to the materials-view
     btn_back = OwnButton(text=self.backStr)
     btn_back.bind(on_press=self.cancel_show)
     # edit the new values
     btn_confirm = OwnButton(text=self.confirmStr)
     btn_confirm.bind(on_press=self.edit_material)
     self.contentLayout.add_widget(btn_confirm)
     self.contentLayout.add_widget(btn_back)
     self.create_popups()
开发者ID:simbtrix,项目名称:screenmix,代码行数:37,代码来源:editor.py

示例3: create_add_delete_area

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_add_delete_area(self):
     self.addDeleteLayout = GridLayout(cols=2, row_force_default=True,
                                       row_default_height=Design.btnHeight,
                                       size_hint_y=None, height=Design.btnHeight,
                                       spacing=Design.spacing)
     btnAdd = OwnButton(text=self.addStr)
     btnDelete = OwnButton(text=self.deleteStr)
     btnAdd.bind(on_press=self.show_add_layer_area)
     btnDelete.bind(on_press=self.delete_layer)
     self.addDeleteLayout.add_widget(btnAdd)
     self.addDeleteLayout.add_widget(btnDelete)
     self.add_widget(self.addDeleteLayout)
开发者ID:simbtrix,项目名称:screenmix,代码行数:14,代码来源:gui.py

示例4: CircleInformation

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
class CircleInformation(GridLayout):
    
    '''
    create the component, where you can change the diameter
    of the cross-section-circle
    '''
    
    # circle-shape
    csShape = ObjectProperty()
    
    diameter = StringProperty('diameter [m]')
    
    '''
    constructor
    '''
    
    def __init__(self, **kwargs):
        super(CircleInformation, self).__init__(**kwargs)
        self.cols, self.spacing = 2, Design.spacing
        self.height, self.size_hint_y = Design.btnHeight, None
    
    '''
    create the gui of the circle-information
    '''
    
    def create_gui(self):
        # create the popup where you can set the diamter
        self.numpad = Numpad(p=self)
        self.popup = OwnPopup(title=self.diameter, content=self.numpad)
        # create the information        
        self.add_widget(OwnLabel(text=self.diameter))
        self.btnDiameter = OwnButton(text=str(self.csShape.d))
        self.btnDiameter.bind(on_press=self.popup.open)
        self.add_widget(self.btnDiameter)
    
    '''
    close the numpad. this method will be call by the numpad-component
    '''
    
    def close_numpad(self):
        self.popup.dismiss()
        
    '''
    set the text of the button
    '''
    
    def finished_numpad(self):
        d = float(self.numpad.lblTextinput.text)
        self.btnDiameter.text = str(d)
        self.csShape.d = d
        self.csShape.view.update_circle(d)
        self.popup.dismiss()
开发者ID:simbtrix,项目名称:mxnix,代码行数:54,代码来源:circleInformation.py

示例5: create_limit_area

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_limit_area(self):
     self.limitArea = GridLayout(cols=2, spacing=Design.spacing)
     self.limitArea.add_widget(OwnLabel(text=self.stressULStr))
     self.limitArea.add_widget(self.btnStressUL)
     self.limitArea.add_widget(OwnLabel(text=self.stressLLStr))
     self.limitArea.add_widget(self.btnStressLL)
     self.limitArea.add_widget(OwnLabel(text=self.strainULStr))
     self.limitArea.add_widget(self.btnStrainUL)
     self.limitArea.add_widget(OwnLabel(text=self.strainLLStr))
     self.limitArea.add_widget(self.btnStrainLL)
     btnConfirm = OwnButton(text='ok')
     btnConfirm.bind(on_press=self.hide_limit_area)
     self.limitArea.add_widget(btnConfirm)
开发者ID:simbtrix,项目名称:mxnix,代码行数:15,代码来源:mulitlinearInformation.py

示例6: create_gui

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_gui(self):
     # self.create_material_information()
     self.materialLayout = GridLayout(cols=1, spacing=2, size_hint_y=None)
     # Make sure the height is such that there is something to scroll.
     self.materialLayout.bind(minimum_height=self.materialLayout.setter('height'))
     for i in self.allMaterials.allMaterials:
         btn = OwnButton(text=i.name)
         btn.bind(on_press=self.show_material_information)
         self.materialLayout.add_widget(btn)
     self.btnMaterialEditor = OwnButton(text=self.createStr)
     self.btnMaterialEditor.bind(on_press=self.show_creater)
     self.materialLayout.add_widget(self.btnMaterialEditor)
     self.add_widget(self.materialLayout)
开发者ID:simbtrix,项目名称:mxnix,代码行数:15,代码来源:editor.py

示例7: create_material_options

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_material_options(self):
     self.layoutMaterials = GridLayout(cols=1, spacing=Design.spacing)
     self.materialEditor = MaterialCreater()
     self.materialEditor._parent = self
     self.popupMaterialEditor = OwnPopup(title='editor', content=self.materialEditor)
     for i in range(0, len(self.allMaterials.allMaterials)):
         btnMaterialA = OwnButton(text=self.allMaterials.allMaterials[i].name)
         btnMaterialA.bind(on_press=self.select_material)
         self.layoutMaterials.add_widget(btnMaterialA)
     self.btnMaterialEditor = OwnButton(text='create material')
     self.btnMaterialEditor.bind(on_press=self.popupMaterialEditor.open)
     self.layoutMaterials.add_widget(self.btnMaterialEditor)
     self.root = ScrollView()
     self.root.add_widget(self.layoutMaterials)
     popupContent = GridLayout(cols=1)
     popupContent.add_widget(self.root)
     self.popupMaterial = OwnPopup(title='material', content=popupContent)
开发者ID:simbtrix,项目名称:mxnix,代码行数:19,代码来源:refEdit.py

示例8: create_material_options

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_material_options(self):
     self.materialSelectionLayout = GridLayout(cols=1, spacing=Design.spacing,
                                               size_hint_y=None)
     # Make sure the height is such that there is something to scroll.
     self.materialSelectionLayout .bind(minimum_height=self.materialSelectionLayout.setter('height'))
     self.materialEditor = MaterialCreater(p=self)
     self.popupMaterialEditor = OwnPopup(title='editor', content=self.materialEditor)
     for i in range(0, len(self.allMaterials.allMaterials) - 1):
         btnMaterialA = OwnButton(text=self.allMaterials.allMaterials[i].name)
         btnMaterialA.bind(on_press=self.select_material)
         self.materialSelectionLayout.add_widget(btnMaterialA)
     self.btnMaterialEditor = OwnButton(text='create material')
     self.btnMaterialEditor.bind(on_press=self.popupMaterialEditor.open)
     self.materialSelectionLayout.add_widget(self.btnMaterialEditor)
     self.root = ScrollView()
     self.root.add_widget(self.materialSelectionLayout)
     popupContent = GridLayout(cols=1)
     popupContent.add_widget(self.root)
     self.popup = OwnPopup(title=self.materialStr, content=popupContent)
开发者ID:simbtrix,项目名称:screenmix,代码行数:21,代码来源:gui.py

示例9: create_gui

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_gui(self):
     self.create_graphs()
     self.slider = Slider()
     self.slider.bind(value=self.update_slider)
     slideArea = GridLayout(cols=2, row_force_default=True,
                            row_default_height=Design.btnHeight, size_hint_y=None,
                            height=1.1 * Design.btnHeight)
     lblArea = GridLayout(cols=3, row_force_default=True,
                          row_default_height=Design.btnHeight, size_hint_y=None,
                          height=1.1 * Design.btnHeight)
     self.normalForceLbl = OwnLabel()
     self.momentLbl = OwnLabel()
     lblArea.add_widget(self.normalForceLbl)
     lblArea.add_widget(self.momentLbl)
     btnClear = OwnButton(text='clear')
     btnClear.bind(on_press=self.clear_graph)
     lblArea.add_widget(btnClear)
     slideArea.add_widget(self.slider)
     slideArea.add_widget(lblArea)
     self.add_widget(slideArea)
开发者ID:simbtrix,项目名称:mxnix,代码行数:22,代码来源:gui.py

示例10: create_add_layer_information_area

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_add_layer_information_area(self):
     self.create_material_options()
     btnConfirm = OwnButton(text='confirm')
     btnCancel = OwnButton(text='cancel')
     btnConfirm.bind(on_press=self.add_layer)
     btnCancel.bind(on_press=self.cancel_adding)
     self.addLayout = GridLayout(cols=2, row_force_default=True,
                                 row_default_height=Design.btnHeight,
                                 size_hint_y=None, height=4.5 * Design.btnHeight,
                                 spacing=Design.spacing)
     self.addLayout.add_widget(OwnLabel(text=self.materialStr))
     self.btnMaterialOption = OwnButton(text=self.steelStr)
     self.btnMaterialOption.bind(on_release=self.popup.open)
     self.addLayout.add_widget(self.btnMaterialOption)
     self.lblMaterialPercent = OwnLabel(text=self.areaStr)
     self.addLayout.add_widget(self.lblMaterialPercent)
     self.areaBtn = OwnButton(text='0.0')
     self.areaBtn.bind(on_press=self.show_numpad)
     self.addLayout.add_widget(self.areaBtn)
     self.addLayout.add_widget(btnConfirm)
     self.addLayout.add_widget(btnCancel)
开发者ID:simbtrix,项目名称:screenmix,代码行数:23,代码来源:gui.py

示例11: create_add_delete

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
 def create_add_delete(self):
     self.btnArea = GridLayout(cols=2, row_force_default=True,
                                 row_default_height=Design.btnHeight,
                                 height=Design.btnHeight,
                                 spacing=Design.spacing)
     # create btns
     addBtnLayer = OwnButton(text=self.addLayerStr)
     deleteBtnLayer = OwnButton(text=self.deleteLayerStr)
     addBtnBar = OwnButton(text=self.addBarStr)
     deleteBtnBar = OwnButton(text=self.deleteBarStr)
     # bind btns
     addBtnLayer.bind(on_press=self.show_add_layer_area)
     deleteBtnLayer.bind(on_press=self.delete_layer)
     addBtnBar.bind(on_press=self.show_add_bar_area)
     deleteBtnBar.bind(on_press=self.delete_bar)
     # fill the are with content
     self.btnArea.add_widget(addBtnLayer)
     self.btnArea.add_widget(deleteBtnLayer)
     self.btnArea.add_widget(addBtnBar)
     self.btnArea.add_widget(deleteBtnBar)
     self.add_widget(self.btnArea)
开发者ID:simbtrix,项目名称:mxnix,代码行数:23,代码来源:refEdit.py

示例12: MaterialLawEditor

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]

#.........这里部分代码省略.........
    
    '''
    create the area where you can the function-type
    '''
    
    def create_selction_area(self):
        self.information = GridLayout(cols=1, spacing=Design.spacing)
        self.create_btns()
        self.information.add_widget(self.btnLinear)
        self.information.add_widget(self.btnMultiLinear)
        self.information.add_widget(self.btnQuadratic)
        self.information.add_widget(self.btnExponential)
        self.information.add_widget(self.btnLogarithm)
        confirmArea = GridLayout(cols=2, spacing=Design.spacing)
        confirmArea.add_widget(self.btnOk)
        confirmArea.add_widget(self.btnCancel)
        self.information.add_widget(confirmArea)
        self.functionSelection.add_widget(self.information)
    
    '''
    create the all btns of the material-law-component where you 
    can select the function-type
    '''
    
    def create_btns(self):
        self.btnLinear = OwnButton(text=self.linearStr)
        self.focusBtn = self.btnLinear
        self.btnMultiLinear = OwnButton(text=self.mulitlinearStr)
        self.btnQuadratic = OwnButton(text=self.quadraticStr)
        self.btnExponential = OwnButton(text=self.expStr)
        self.btnLogarithm = OwnButton(text=self.logStr)
        self.btnOk = OwnButton(text=self.okStr)
        self.btnCancel = OwnButton(text=self.cancelStr)
        self.btnOk.bind(on_press=self.confirm)
        self.btnCancel.bind(on_press=self.cancel)
        self.btnLinear.bind(on_press=self.show_linear)
        self.btnMultiLinear.bind(on_press=self.show_multilinear)
        self.btnQuadratic.bind(on_press=self.show_quadratic)
        self.btnExponential.bind(on_press=self.show_exponentiell)   
        self.btnLogarithm.bind(on_press=self.show_logarithm) 
    
    '''
    show the linear-function-view
    '''
    
    def show_linear(self, btn):
        self.focusBtn = btn
        self.graph.remove_plot(self.focusPlot)
        self.focusPlot = self.pLinear
        self.graph.add_plot(self.focusPlot)
    
    '''
    show the quadratic-function-view
    '''
    
    def show_quadratic(self, btn):
        if self.boolQuadraticEditor:
            self.quadraticEditor = QuadraticEditor(lawEditor=self)
            self.boolQuadraticEditor = False
        self.focusBtn = btn
        self.graph.remove_plot(self.focusPlot)
        self.focusPlot = self.pQuadratic
        self.graph.add_plot(self.focusPlot)
    
    '''
    show the exp-function-view
开发者ID:simbtrix,项目名称:mxnix,代码行数:70,代码来源:lawEditor.py

示例13: ObjectProperty

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
class AInformation:
    
    '''
    base class of the function-informations
    '''
    
    # editor
    editor = ObjectProperty()
    
    # string function
    functionStr = StringProperty('function:')
    
    # string strain-upper-limit
    strainULStr = StringProperty('strain-upper-limit:')
    
    # string strain-lower-limit
    strainLLStr = StringProperty('strain-lower-limit:')
    
    # string ok
    okStr = StringProperty('ok')
    
    # string cancel
    cancelStr = StringProperty('cancel')
    
    '''
    show the popup where the user can select the function-type
    '''
    
    def show_type_selection(self, btn):
        self.editor.lawEditor.editor.open()
    
    '''
    close the numpad when the user cancel the input
    '''
        
    def close_numpad(self):
        self.popupNumpad.dismiss()
    
    '''
    create all btns, which are in all information the same
    '''
        
    def create_base_btns(self):
        self.btnStrainUL = OwnButton(text=str(self.editor.maxStrain))
        self.btnStrainLL = OwnButton(text=str(self.editor.minStrain))
        self.btnConfirm = OwnButton(text=self.okStr)
        self.btnCancel = OwnButton(text=self.cancelStr)
        self.btnConfirm.bind(on_press=self.editor.confirm)
        self.btnStrainUL.bind(on_press=self.show_popup)
        self.btnStrainLL.bind(on_press=self.show_popup)
        self.btnCancel.bind(on_press=self.editor.cancel)
    
    '''
    add the base_btns to the root-widget
    '''
    def add_base_btns(self):
        self.add_widget(OwnLabel(text=self.strainULStr))
        self.add_widget(self.btnStrainUL)
        self.add_widget(OwnLabel(text=self.strainLLStr))
        self.add_widget(self.btnStrainLL)
        self.add_widget(self.btnConfirm)
        self.add_widget(self.btnCancel)
    
    '''
    set the popup-titel when the focusbtn is a base-btn
    '''
    def set_popup_title(self):
        if self.focusBtn == self.btnStrainUL:
            self.popupNumpad.title = self.strainULStr
        elif self.focusBtn == self.btnStrainLL:
            self.popupNumpad.title = self.strainLLStr
开发者ID:simbtrix,项目名称:mxnix,代码行数:73,代码来源:ainformation.py

示例14: QuadraticInformation

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
class QuadraticInformation(GridLayout, AInformation):
    
    '''
    with the QuadraticInformation you can set the properties of the function
    '''
    
    # string quadratic
    quadraticStr = StringProperty('quadratic')
    
    # string parameter a
    aStr = StringProperty('a:')
    
    # string parameter b
    bStr = StringProperty('b:')
    
    
    '''
    constructor
    '''
    
    def __init__(self, **kwargs):
        super(QuadraticInformation, self).__init__(**kwargs)
        self.cols, self.spacing = 2, Design.spacing
        self.create_information()
        # create the numpad
        self.numpad = Numpad(sign=True, p=self)
        self.popupNumpad = OwnPopup(content=self.numpad)
    
    '''
    create the gui of the information, 
    where you can change the properties of the quadratic-function
    '''
        
    def create_information(self):
        self.create_btns()
        self.add_widget(OwnLabel(text=self.functionStr))
        self.add_widget(self.btnQuadratic)
        self.add_widget(OwnLabel(text=self.aStr))
        self.add_widget(self.aBtn)
        self.add_widget(OwnLabel(text=self.bStr))        
        self.add_widget(self.bBtn)
        self.add_base_btns()
        
    '''
    create all btns of the gui
    '''
    
    def create_btns(self):
        self.aBtn = OwnButton(text=str(self.editor.a))
        self.aBtn.bind(on_press=self.show_popup)
        self.bBtn = OwnButton(text=str(self.editor.b))
        self.bBtn.bind(on_press=self.show_popup)
        self.btnQuadratic = OwnButton(text=self.quadraticStr)
        self.btnQuadratic.bind(on_press=self.show_type_selection)
        self.create_base_btns()

    '''
    the method finished_numpad close the numpad_popup
    '''
    
    def finished_numpad(self):
        v = float(self.numpad.lblTextinput.text)
        if self.focusBtn == self.aBtn:
            self.editor.a = v
            self.editor.view.update_points()
        elif self.focusBtn == self.bBtn:
            self.editor.b = v
        elif self.focusBtn == self.btnStrainUL:
            if v>self.editor.minStrain:
                self.editor.maxStrain = v
            else:
                return
        elif self.focusBtn == self.btnStrainLL:
            if v<self.editor.maxStrain:
                self.editor.minStrain = v
            else:
                return
        self.editor.view.update_graph_sizeproperties()
        self.focusBtn.text = str(v)
        self.popupNumpad.dismiss()
        self.numpad.reset_text()
    
    '''
    open the numpad popup
    '''
    
    def show_popup(self, btn):
        self.focusBtn = btn
        if self.focusBtn == self.aBtn:
            self.popupNumpad.title = self.aStr
        elif self.focusBtn == self.bBtn:
            self.popupNumpad.title = self.bStr
        self.set_popup_title()
        self.popupNumpad.open()
    
    '''
    update the complete information by the given function-properties
    '''
        
    def update_function(self, points, minStrain, maxStrain, a, b):
#.........这里部分代码省略.........
开发者ID:simbtrix,项目名称:mxnix,代码行数:103,代码来源:quadraticInformation.py

示例15: MaterialCreater

# 需要导入模块: from ownComponents.ownButton import OwnButton [as 别名]
# 或者: from ownComponents.ownButton.OwnButton import bind [as 别名]
class MaterialCreater(GridLayout):
    
    '''
    the material-creater is the component, where the user 
    can add new material
    '''
    
    # parent of the creater
    p = ObjectProperty()  
    
    createStr = StringProperty('create')
    
    cancelStr = StringProperty('cancel')
    
    densityStr = StringProperty('density[kg/m^3]:')
    
    stiffnessStr = StringProperty('stiffness[MPa]:')
    
    priceStr = StringProperty('price[euro/kg]:')
    
    strengthStr = StringProperty('strength[MPa]:')
    
    nameStr = StringProperty('name')
    
    defaultValueStr = StringProperty('1.0')
    
    # constructor
    def __init__(self, **kwargs):
        super(MaterialCreater, self).__init__(**kwargs)
        self.cols, self.spacing = 2, Design.spacing
        self.height = Design.btnHeight
        self.row_force_default=True
        self.row_default_height=Design.btnHeight
        self.create_gui()
        
    '''
    the method create gui create the gui of 
    the material_editor and create the popups
    '''
        
    def create_gui(self):
        self.create_popups()
        self.create_buttons()
        self.add_widget(OwnLabel(text=self.nameStr))
        self.add_widget(self.btnName)
        self.add_widget(OwnLabel(text=self.priceStr))
        self.add_widget(self.btnPrice)
        self.add_widget(OwnLabel(text=self.densityStr))
        self.add_widget(self.btnDensity)
        self.add_widget(OwnLabel(text=self.stiffnessStr))
        self.add_widget(self.btnStiffness)
        self.add_widget(OwnLabel(text=self.strengthStr))
        self.add_widget(self.btnStrength)
        self.add_widget(self.btnCreate)
        self.add_widget(self.btnCancel)
    
    '''
    the method create_buttons create all buttons of the class
    '''
        
    def create_buttons(self):
        # materialname
        self.btnName = OwnButton(text=self.nameStr)
        self.btnName.bind(on_press=self.use_keyboard)
        # materialprice
        self.btnPrice = OwnButton(text=self.defaultValueStr)
        self.btnPrice.bind(on_press=self.use_numpad)
        # materialdensity
        self.btnDensity = OwnButton(text=self.defaultValueStr)
        self.btnDensity.bind(on_press=self.use_numpad)
        # materialstiffness
        self.btnStiffness = OwnButton(text=self.defaultValueStr)
        self.btnStiffness.bind(on_press=self.use_numpad)
        # materialstrength
        self.btnStrength = OwnButton(text=self.defaultValueStr)
        self.btnStrength.bind(on_press=self.use_numpad)
        # create material and cancel 
        self.btnCreate = OwnButton(text=self.createStr)
        self.btnCreate.bind(on_press=self.create_material)
        self.btnCancel = OwnButton(text=self.cancelStr)
        self.btnCancel.bind(on_press=self.cancel_creating)
        
    '''
    the method use_keyword open the keyboard_popup for the user
    '''
        
    def use_keyboard(self, button):
        self.keyboard.lblTextinput.text = button.text
        self.popupKeyboard.open()
    
    '''
    the method use_numpad open the numpad_popup for the user
    '''
        
    def use_numpad(self, btn):
        self.btnFocus = btn
        self.numpad.lblTextinput.text = btn.text
        # find the property and set the title of the popup
        if self.btnFocus == self.btnDensity:
            self.popupNumpad.title = self.densityStr
#.........这里部分代码省略.........
开发者ID:simbtrix,项目名称:screenmix,代码行数:103,代码来源:creater.py


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