本文整理汇总了Python中pyjamas.ui.HorizontalPanel.HorizontalPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Python HorizontalPanel.add方法的具体用法?Python HorizontalPanel.add怎么用?Python HorizontalPanel.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.HorizontalPanel.HorizontalPanel
的用法示例。
在下文中一共展示了HorizontalPanel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createButtonPanel
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def _createButtonPanel(self):
hp = HorizontalPanel()
self.okBtn = Button('OK', self.onOk, StyleName=self.baseStyleName + '-button')
self.cancelBtn = Button('Cancel', self.onCancel, StyleName=self.baseStyleName + '-button')
hp.add(self.okBtn)
hp.add(self.cancelBtn)
return hp
示例2: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
class Site:
def __init__(self):
# Record the image url for easy access
self.IMAGES_URL = "http://www.cse.nd.edu/~cmc/teaching/cse30332_sp15/images"
# The title label is intially empty but will be filled with the top
# recommended movie by the time the page is viewed
self.title_l = Label("", StyleName="teststyle")
self.up_b = Button("UP", post_vote)
self.down_b = Button("DOWN", post_vote)
self.rating_l = Label("", StyleName="teststyle")
self.img = Image("")
# Construct three vertical panels to make he display slightly columnar
self.leftVertPanel = VerticalPanel()
self.midlVertPanel = VerticalPanel()
self.riteVertPanel = VerticalPanel()
self.horizontalizer = HorizontalPanel()
# Add the buttons to the correct vertical panels!!!
self.midlVertPanel.add(self.title_l)
self.midlVertPanel.add(self.img)
self.midlVertPanel.add(self.rating_l)
self.riteVertPanel.add(self.down_b)
self.leftVertPanel.add(self.up_b)
# Add all the panels to the horizontal panel
self.horizontalizer.add(self.leftVertPanel)
self.horizontalizer.add(self.midlVertPanel)
self.horizontalizer.add(self.riteVertPanel)
# Add the horizontal panel to the vertical one
RootPanel().add(self.horizontalizer)
# Get the first recommendation
get_recommendation()
示例3: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, row, column=0):
super(Game, self).__init__(StyleName='game')
self.sinkEvents(Event.ONCONTEXTMENU) # to disable right click
self.row = row
self.column = column or row
self.level = 1
self.toppers = [[], [], []] # storage for top scorers for 3 levels.
self.remote = DataService()
self.remote_handler = RemoteHandler(self)
self.remote.get_scores(self.remote_handler)
# contents of Game
menubar = MineMenuBar(self)
score_board = HorizontalPanel(StyleName='score-board')
self.grid_panel = SimplePanel(StyleName='grid-panel')
self.add(menubar)
self.add(score_board)
self.add(self.grid_panel)
# contents of score_board
self.counter = Label('000', StyleName='digit counter')
self.face = Smiley(self)
self.timer = Label('000', StyleName='digit timer')
for one in (self.counter, self.face, self.timer):
score_board.add(one)
score_board.setCellWidth(self.face, '100%')
self.create_grid()
self.start()
示例4: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, left = 50, top = 50):
DialogBox.__init__(self, modal = False)
self.setPopupPosition(left, top)
self.setText("Preferences")
ftable = FlexTable()
ftableFormatter = ftable.getFlexCellFormatter()
row = 0
try:
self.fileLocation = getCookie("fileLocation")
except:
self.fileLocation = None
row += 1
ftable.setWidget(row, 0, Label("Sheet loaded on startup", wordWrap=False))
self.fileLocationInput = TextBox()
self.fileLocationInput.addChangeListener(self.checkValid)
self.fileLocationInput.addKeyboardListener(self)
self.fileLocationInput.setVisibleLength(30)
self.fileLocationInput.setText(self.fileLocation)
ftable.setWidget(row, 1, self.fileLocationInput)
row += 1
hpanel = HorizontalPanel()
self.saveBtn = Button("Save", self.onSave)
self.saveBtn.setEnabled(False)
hpanel.add(self.saveBtn)
self.cancelBtn = Button("Cancel", self.onCancel)
hpanel.add(self.cancelBtn)
ftable.setWidget(row, 0, hpanel)
ftableFormatter.setColSpan(row, 0, 2)
self.setWidget(ftable)
示例5: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, tabBar=None, *kwargs):
TabPanel.__init__(self, tabBar, *kwargs)
self.parent_buoy = None
self.tabs = [{'hovertype' : ListBox(), 'name' : 'Cost'},
{'hovertype' : ListBox(), 'name' : 'Speed'}]
self.cost = self.tabs[0]['hovertype']
items = ['cheap','next to cheap','average','above average','expensive','if you have to ask']
self.cost.setVisibleItemCount(len(items))
for item in items:
self.cost.addItem(item)
self.cost.addChangeListener(self)
self.speed = self.tabs[1]['hovertype']
items = ['very slow','slow','average','above average','fast','quick','hyper','turbo','lightening','light']
self.speed.setVisibleItemCount(len(items))
for item in items:
self.speed.addItem(item)
self.speed.addChangeListener(self)
for tab in self.tabs:
h = HorizontalPanel()
h.add(tab['hovertype'])
self.add(h, tab['name'])
示例6: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, chart):
self.chart = chart
self.canvas = chart.canvas
self.b2 = Button("Compositing", self)
self.b3 = Button("Paths & shapes", self)
self.b4 = Button("Arcs & circles", self)
self.b1 = Button("Bezier curves", self)
self.b6 = Button("Colors", self)
self.b7 = Button("Translating", self)
self.b8 = Button("Scaling", self)
self.b5 = Button("Rotating", self)
self.b10 = Button("Transparency", self)
self.b11 = Button("Lines", self)
self.b9 = Button("Animations", self)
hp = HorizontalPanel()
vp = VerticalPanel()
vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
vp.add(Label("MENU"))
vp.setSpacing(6)
vp.add(self.b2)
vp.add(self.b3)
vp.add(self.b4)
vp.add(self.b1)
vp.add(self.b6)
vp.add(self.b7)
vp.add(self.b8)
vp.add(self.b5)
vp.add(self.b10)
vp.add(self.b11)
vp.add(self.b9)
hp.add(vp)
Composite.__init__(self, hp)
示例7: HorizontalToolbar
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
class HorizontalToolbar(SimplePanel):
def __init__(self, onRequestMore=None, onCollapseAll=None, onExpandAll=None, onSort=None):
super(HorizontalToolbar, self).__init__(StyleName=Styles.TOOLBAR_HORIZONTAL)
self.content = HorizontalPanel()
self.requestMoreButton = Button('More', onRequestMore, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.requestMoreButton)
self.itemsShowingLabel = Label(StyleName=Styles.TOOLBAR_TEXT)
self.content.add(self.itemsShowingLabel)
self.setNumberOfItemsShowingText(0, 0)
self.collapseAllButton = Button('Collapse All', onCollapseAll, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.collapseAllButton)
self.expandAllButton = Button('Expand All', onExpandAll, StyleName=Styles.TOOLBAR_BUTTON)
self.content.add(self.expandAllButton)
if onSort:
self.content.add(SortPanel(onSort))
self.setWidget(self.content)
return
def setNumberOfItemsShowingText(self, number, total):
self.itemsShowingLabel.setText('Showing %s of %s total items.' % (number, total))
return
示例8: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, app):
DialogBox.__init__(self)
self.app = app
self.table=FlexTable()
self.table.setText(0, 0, "Please enter username and password")
self.table.getFlexCellFormatter().setColSpan(0, 0, 2)
self.table.setText(1, 0, "Username")
self.handle = TextBox()
h = getCookie('handle')
self.handle.setText(h)
self.table.setWidget(1, 1, self.handle)
self.table.setText(2, 0, "Password")
self.pwd = PasswordTextBox()
self.table.setWidget(2, 1, self.pwd)
self.table.setHTML(3,0,"")
self.table.getFlexCellFormatter().setColSpan(3, 0, 2)
h = HorizontalPanel()
self.table.setWidget(4,0, h)
self.table.getFlexCellFormatter().setColSpan(4, 0, 2)
h.add(Button("Ok", getattr(self, "onOk")))
h.add(Button("Cancel", getattr(self, "onClose")))
h.setSpacing(4)
self.setHTML("<b>Login</b>")
self.setWidget(self.table)
left = (Window.getClientWidth() - 200) / 2
top = (Window.getClientHeight() - 100) / 2
self.setPopupPosition(left,top)
示例9: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self):
Sink.__init__(self)
colour_grid = ColourGridCanvas()
rotated = RotatedCanvas()
spheres = SpheresCanvas()
pattern = PatternCanvas()
spiro = SpiroCanvas()
self.solar = SolarCanvas()
row0 = HorizontalPanel()
row0.setSpacing(8)
row0.add(colour_grid)
row0.add(rotated)
row0.add(spheres)
row0.add(pattern)
row1 = HorizontalPanel()
row1.setSpacing(8)
row1.add(self.solar)
row1.add(spiro)
panel = VerticalPanel()
panel.add(row0)
panel.add(row1)
self.setWidget(panel)
示例10: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self):
DockPanel.__init__(self)
self.setSize('100%', '100%')
self.geocoder = Geocoder()
# widgets
topPanel = HorizontalPanel()
self.add(topPanel, DockPanel.NORTH)
self.address = TextBox()
self.address.setText("Sydney, NSW")
self.address.addChangeListener(self.codeAddress)
topPanel.add(self.address)
button = Button("Geocode")
button.addClickListener(self.codeAddress)
topPanel.add(button)
# now, the map
mapPanel = SimplePanel()
mapPanel.setSize('600', '400')
self.add(mapPanel, DockPanel.CENTER)
options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644),
mapTypeId=MapTypeId.ROADMAP)
self.map = Map(mapPanel.getElement(), options)
示例11: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, app):
self.app = app
DialogWindow.__init__(
self, modal=False,
minimize=True, maximize=True, close=True,
)
self.closeButton = Button("Close", self)
self.saveButton = Button("Save", self)
self.setText("Sample DialogWindow with embedded image")
self.msg = HTML("", True)
global _editor_id
_editor_id += 1
editor_id = "editor%d" % _editor_id
#self.ht = HTML("", ID=editor_id)
self.txt = TextArea(Text="", VisibleLines=30, CharacterWidth=80,
ID=editor_id)
dock = DockPanel()
dock.setSpacing(4)
hp = HorizontalPanel(Spacing="5")
hp.add(self.saveButton)
hp.add(self.closeButton)
dock.add(hp, DockPanel.SOUTH)
dock.add(self.msg, DockPanel.NORTH)
dock.add(self.txt, DockPanel.CENTER)
dock.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_RIGHT)
dock.setCellWidth(self.txt, "100%")
dock.setWidth("100%")
self.setWidget(dock)
self.editor_id = editor_id
self.editor_created = False
示例12: ControlPanel
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
class ControlPanel(Composite):
def __init__(self):
Composite.__init__(self)
self.buttons = HorizontalPanel()
self.buttons.setSpacing("10px")
self.refresh_button = ControlButton("images/refresh.png",
"images/refresh_down.png",
"reload",
"reload"
)
self.refresh_button.addMouseListener(ReloadButtonListner())
self.refresh_button.base = self
self.start_button = ControlButton("images/start.png"
, "images/pause.png"
, " start"
, " pause"
)
self.start_button.addMouseListener(StartButtonListner())
self.start_button.base = self
self.buttons.add(self.refresh_button)
self.buttons.add(self.start_button)
self.initWidget(self.buttons)
示例13: onCellClicked
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def onCellClicked(self, sender, row, col):
if self.drill==0:
self.drill += 1
self.vp.clear()
self.grid.clear()
self.vp.add(self.up)
self.vp.add(self.grid)
gridcols = self.grid.getColumnCount()
album = self.albums[row+col+(row*(gridcols-1))]
url = "http://picasaweb.google.com/data/feed/base/user/" + self.userid + "/albumid/" + album["id"] + "?alt=json-in-script&kind=photo&hl=en_US&callback=restCb"
self.doRESTQuery(url, self.timer)
elif self.drill==1:
self.drill += 1
gridcols = self.grid.getColumnCount()
self.pos =row+col+(row*(gridcols-1))
photo = self.photos[self.pos]
self.vp.clear()
self.fullsize = HTML('<img src="' + photo["full"] + '"/>')
hp = HorizontalPanel()
hp.add(self.up)
hp.add(self.prev)
hp.add(self.next)
hp.setSpacing(8)
self.vp.add(hp)
self.vp.add(self.fullsize)
示例14: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, owner):
Composite.__init__(self)
self.owner = owner
self.bar = DockPanel()
self.gotoFirst = Button("<<", self)
self.gotoNext = Button(">", self)
self.gotoPrev = Button("<", self)
self.status = HTML()
self.initWidget(self.bar)
self.bar.setStyleName("navbar")
self.status.setStyleName("status")
buttons = HorizontalPanel()
buttons.add(self.gotoFirst)
buttons.add(self.gotoPrev)
buttons.add(self.gotoNext)
self.bar.add(buttons, DockPanel.EAST)
self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
self.bar.add(self.status, DockPanel.CENTER)
self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT)
self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE)
self.bar.setCellWidth(self.status, "100%")
self.gotoPrev.setEnabled(False)
self.gotoFirst.setEnabled(False)
示例15: __init__
# 需要导入模块: from pyjamas.ui.HorizontalPanel import HorizontalPanel [as 别名]
# 或者: from pyjamas.ui.HorizontalPanel.HorizontalPanel import add [as 别名]
def __init__(self, topPanel):
TickeryTab.__init__(self, topPanel)
# Get query names (if they exist) from the request. We don't check
# that we're the wanted tab: if 2 names are given, just use them.
args = Window.getLocation().getSearchDict()
name1 = args.get("name1")
name2 = args.get("name2")
if name1 and name2:
self.autoActivate = True
if name1:
name1 = urllib.unquote_plus(name1)
else:
name1 = _defaultName1
if name2:
name2 = urllib.unquote_plus(name2)
else:
name2 = _defaultName2
v1 = VerticalPanel()
self.name1 = text.TextBoxFocusHighlight(
Text=name1, MaxLength=self.textBoxLength, VisibleLength=self.textBoxLength, StyleName="simple-query-box"
)
v1.add(self.name1)
self.followResult1 = HorizontalPanel(Spacing=4)
v1.add(self.followResult1)
v2 = VerticalPanel()
self.name2 = text.TextBoxFocusHighlight(
Text=name2, MaxLength=self.textBoxLength, VisibleLength=self.textBoxLength, StyleName="simple-query-box"
)
v2.add(self.name2)
self.followResult2 = HorizontalPanel(Spacing=4)
v2.add(self.followResult2)
self.goButton = go.GoButton(self)
v = VerticalPanel(Spacing=2, StyleName="help-panel")
v.add(HTML("Enter two Twitter usernames", StyleName="simple-instructions"))
v.add(v1)
h = HorizontalPanel()
h.add(v2)
h.add(self.goButton)
v.add(h)
self.topGrid.setWidget(0, 1, v)
formatter = self.topGrid.getCellFormatter()
formatter.setHorizontalAlignment(0, 1, "left")
self.checkResult = HorizontalPanel()
self.add(self.checkResult)
self.results = userlist.UserListPanel(self, topPanel)
self.add(self.results)
# allow keypress ENTER reaction
self.name1.addKeyboardListener(self)
self.name2.addKeyboardListener(self)