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


Python TextBox.setEnabled方法代码示例

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


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

示例1: onModuleLoad

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setEnabled [as 别名]
class GridEdit:
    def onModuleLoad(self):

        self.input = TextBox()
        self.input.setEnabled(False)
        self.input.addKeyboardListener(self)

        self.g=Grid()
        self.g.resize(5, 5)
        self.g.setHTML(0, 0, "<b>Grid Edit</b>")
        self.g.setBorderWidth(2)
        self.g.setCellPadding(4)
        self.g.setCellSpacing(1)
        self.g.setWidth("500px")
        self.g.setHeight("120px")
        self.g.addTableListener(self)

        self.initGrid()
        RootPanel().add(self.input)
        RootPanel().add(self.g)

    def onKeyDown(self, sender, keycode, modifiers):
        pass

    def onKeyUp(self, sender, keycode, modifiers):
        pass

    def onKeyPress(self, sender, keycode, modifiers):
        if keycode == KeyboardListener.KEY_ESCAPE:
            self.input.setEnabled(False)
        elif keycode == KeyboardListener.KEY_ENTER:
            self.input.setEnabled(False)
            val = self.input.getText()
            self.set_grid_value(self.row, self.col, val)

    def onCellClicked(self, sender, row, col):
        self.row = row
        self.col = col
        val = self.values[row][col]
        self.input.setText(val)
        self.input.setEnabled(True)
        self.input.setFocus(True)

    def set_grid_value(self, row, col, val):
        self.values[row][col] = val
        if val == "":
            val = "&nbsp;"
        self.g.setHTML(row, col, val)

    def initGrid(self):

        self.values = {}
        for y in range(5):
            self.values[y] = {}
            for x in range(5):
                self.values[y][x] = ""
        for y in range(5):
            for x in range(5):
                val = self.values[y][x]
                self.set_grid_value(y, x, val)
开发者ID:Afey,项目名称:pyjs,代码行数:62,代码来源:GridEdit.py

示例2: createControlPanel

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setEnabled [as 别名]
	def createControlPanel(self, controlNames):
		flowPanel=FlowPanel()
		newLabels=[]
		for buttonName in controlNames:
			newPanel=HorizontalPanel()
			newLabels.append(Label(buttonName))
			newPanel.add(newLabels[-1])
			newTextBox=TextBox()
			newTextBox.setEnabled(True)
			newTextBox.setWidth(80)
			newPanel.add(newTextBox)	
			if buttonName=="RangeLo" :
				newTextBox.setText("100") # Default values
				self.rangeLowBox=newTextBox
			elif buttonName=="RangeHi" :
				newTextBox.setText("150")
				self.rangeHighBox=newTextBox
			elif buttonName=="Steps" :
				newTextBox.setText("1")
				self.stepSizeBox=newTextBox
			elif buttonName=="FileName": newTextBox.setText("TestRun.png")
			
			#newTextBox.addChangeListener(self)
			newTextBox.setTitle(buttonName)
			
			self.controlValueEntries[buttonName]=newTextBox	
			
			flowPanel.add(newPanel)
		

		# Set all of the widths of the labels to be the same, so that the boxes line up
		maxWidth=0
		for label in newLabels :
			# This doesn't work for some reason
			#if label.getWidth() > maxWidth : maxWidth=label.getWidth()
			if len(label.getText())*9 > maxWidth : maxWidth=len(label.getText())*9
		for label in newLabels :
			label.setWidth(maxWidth)

		return flowPanel
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:42,代码来源:SCurveRunPanel.py

示例3: createRegisterPanel

# 需要导入模块: from pyjamas.ui.TextBox import TextBox [as 别名]
# 或者: from pyjamas.ui.TextBox.TextBox import setEnabled [as 别名]
	def createRegisterPanel( self, registerNames ) :
		"""
		Creates panels and buttons for everything given in registerNames, and returns the main panel.
		"""
		flowPanel=FlowPanel()
		for buttonName in registerNames :
			newPanel=HorizontalPanel()
			label=Label(buttonName)
			newPanel.add( label )
			newTextBox=TextBox()
			newTextBox.setEnabled(False)
			newTextBox.setWidth(80)
			statusBox=TextBox()
			statusBox.setEnabled(False)
			statusBox.setWidth(30)
			newPanel.add(newTextBox)
			newPanel.add(statusBox)
			newPanel.setCellHorizontalAlignment( newTextBox, HasHorizontalAlignment.ALIGN_RIGHT )
			newPanel.setCellHorizontalAlignment( statusBox, HasHorizontalAlignment.ALIGN_RIGHT )
			newPanel.setCellWidth( statusBox, "20px" )
			newPanel.setWidth("100%")
			#newPanel.setStyleName("areaStyle");
			#newPanel.setBorderWidth(5);
			
			newTextBox.setText("select chip...")
			newTextBox.addChangeListener(self)
			newTextBox.setTitle(buttonName) # This isn't displayed, but it's useful to have stored
			
			self.i2cValueEntries[buttonName]=newTextBox	
			
			self.statusValueEntries[buttonName]=statusBox
			statusBox.setTitle(buttonName)
			statusBox.setText("...")
			
			flowPanel.add(newPanel)


		return flowPanel
开发者ID:BristolHEP-CBC-Testing,项目名称:cbcanalysis,代码行数:40,代码来源:I2CPanel.py


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