本文整理汇总了Python中pyjamas.ui.AbsolutePanel.AbsolutePanel类的典型用法代码示例。如果您正苦于以下问题:Python AbsolutePanel类的具体用法?Python AbsolutePanel怎么用?Python AbsolutePanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbsolutePanel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
AbsolutePanel.__init__(self)
StyleSheetCssText(margins) # initialize css...
header = """<div><H2 align="center">Welcome to Unbeatable Tic-Tac-Toe!</H2><br>My <a href="https://github.com/chetweger/min-max-games/blob/master/ttt/ttt.py">implementation</a> uses the min-max search algorithm with alpha beta pruning and a transposition table!</div>"""
header = HTML(header, StyleName='margins_both')
self.add(header)
self.ai_first = Button("AI first.", self, StyleName='margins_left')
self.add(self.ai_first)
self.new_game = Button("New game", self, StyleName='margins_left')
self.add(self.new_game)
self.g=Grid(StyleName='margins_left')
self.g.resize(3, 3)
self.g.setBorderWidth(2)
self.g.setCellPadding(4)
self.g.setCellSpacing(1)
self.init()
self.add(self.g)
self.state = State()
self.game_resolution=Label("", StyleName='margins_left')
self.add(self.game_resolution)
开发者ID:chetweger,项目名称:min-max-games,代码行数:28,代码来源:TTT.py
示例2: remove
def remove(self, widget):
if self.getWidget(0) == widget:
self._container1.remove(widget)
elif self.getWidget(1) == widget:
self._container2.remove(widget)
else:
AbsolutePanel.remove(self, widget)
开发者ID:,项目名称:,代码行数:7,代码来源:
示例3: __init__
def __init__(self,parent):
AbsolutePanel.__init__(self)
self.roleList = ListBox()
self.roleList.setWidth('300px')
self.roleList.setVisibleItemCount(6)
self.roleList.addChangeListener(self.onListChange)
#self.roleList.addKeyboardListener(self)
self.roleCombo = ListBox()
self.roleCombo.addKeyboardListener(self)
self.roleCombo.addChangeListener(self.onComboChange)
self.addBtn = Button("Add")
self.addBtn.setEnabled(False)
self.removeBtn = Button("Remove")
self.removeBtn.setEnabled(False)
vpanel = VerticalPanel()
vpanel.add(self.roleList)
hpanel = HorizontalPanel()
hpanel.add(self.roleCombo)
hpanel.add(self.addBtn)
hpanel.add(self.removeBtn)
vpanel.add(hpanel)
self.add(vpanel)
self.clearForm()
return
开发者ID:Afey,项目名称:pyjs,代码行数:27,代码来源:components.py
示例4: __init__
def __init__(self):
AbsolutePanel.__init__(self)
self.app = CompaniesApp()
self.history = []
self.save = Button("save", self)
self.selectDepartment = Button("select", self)
self.selectEmployee = Button("select", self)
self.edit = Button("edit", self)
self.cut = Button("cut", self)
self.back = Button("back", self)
self.name = TextBox()
self.address = TextBox()
self.manager = TextBox()
self.departments = ListBox(Size=("100%"), VisibleItemCount="5")
self.employees = ListBox(Size=("100%"), VisibleItemCount="5")
self.total = TextBox()
self.errors = VerticalPanel()
self.grid = Grid()
self.allPanels = VerticalPanel()
self.allPanels.add(self.grid)
self.allPanels.add(self.errors)
self.add(self.allPanels)
self.initCompanyGUI()
开发者ID:101companies,项目名称:101repo,代码行数:30,代码来源:101Companies.py
示例5: __init__
def __init__(self, key, title, content):
AbsolutePanel.__init__(self)
self.edit_header = Label("Edit a Post", StyleName="header_label")
self.edit_title_label = Label("Title:")
self.edit_title = TextBox()
self.edit_title.setMaxLength(255)
self.edit_content = TextArea()
self.edit_content.setVisibleLines(2)
self.edit_button = Button("Save")
self.edit_cancel_button = Button("Cancel")
self.edit_hidden_key = Hidden()
self.error_message_label = Label("", StyleName="error_message_label")
edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
edit_contents.add(self.edit_header)
edit_contents.add(self.edit_title_label)
edit_contents.add(self.edit_title)
edit_contents.add(self.edit_content)
edit_contents.add(self.edit_button)
edit_contents.add(self.edit_cancel_button)
edit_contents.add(self.error_message_label)
edit_contents.add(self.edit_hidden_key)
self.edit_dialog = DialogBox(glass=True)
self.edit_dialog.setHTML('<b>Blog Post Form</b>')
self.edit_dialog.setWidget(edit_contents)
left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
self.edit_dialog.setPopupPosition(left, top)
self.edit_dialog.hide()
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:components.py
示例6: __init__
def __init__(self, **kwargs):
""" setMatchPattern - defaults to '' to match everything
match pattern examples: '^[0-9]*$' is for digits only
'^[0-9,A-Z]*$' is for digits and uppercase
setMaxLength
setText
OB """
kwargs['MatchPattern'] = kwargs.pop('MatchPattern', '')
cs = kwargs.pop('CursorStyle', "inputbox-cursor")
gs = kwargs.pop('StyleName', 'gwt-inputbox')
ap = AbsolutePanel(StyleName="inputbox")
self.tp = Grid(StyleName=gs, Width="100%", Height="100%",
CellPadding=0, CellSpacing=0)
self.cursor = HTML(StyleName=cs)
ap.add(self.tp)
ap.add(self.cursor, 0, 0)
self.cf = self.tp.getCellFormatter()
FocusPanel.__init__(self, Widget=ap, **kwargs)
self.addTableListener(self)
self.addKeyboardListener(self)
self.addFocusListener(self)
self.word_selected_pos = 0
self.ctimer = Timer(notify=self.cursorFlash)
self.focusset = False
self.cstate = False
self._keypressListeners = []
开发者ID:,项目名称:,代码行数:31,代码来源:
示例7: setWidth
def setWidth(self, width):
self.fontsize = math.floor(width / self.cols)
AbsolutePanel.setWidth(self, "%dpx" % (self.cols*self.fontsize))
ratio = self.fontsize / self.fontheight
DOM.setStyleAttribute(self.getElement(), 'fontSizeAdjust', str(ratio))
开发者ID:brodybits,项目名称:pyjs,代码行数:7,代码来源:textconsole.py
示例8: __init__
def __init__(self, width, height):
AbsolutePanel.__init__(self)
self.setWidth(width)
self.setHeight(height)
self.window = {}
self.window_zindex = {}
开发者ID:anandology,项目名称:pyjamas,代码行数:8,代码来源:Screen.py
示例9: __init__
def __init__(self,parent):
AbsolutePanel.__init__(self)
ftable = FlexTable()
ftable.setWidget(0, 0, Label("First Name", wordWrap=False))
ftableFormatter = ftable.getFlexCellFormatter()
self.firstInput = TextBox()
self.firstInput.addChangeListener(self.checkValid)
self.firstInput.addKeyboardListener(self)
ftable.setWidget(0, 1, self.firstInput)
ftable.setWidget(1, 0, Label("Last Name", wordWrap=False))
self.lastInput = TextBox()
self.lastInput.addChangeListener(self.checkValid)
self.lastInput.addKeyboardListener(self)
ftable.setWidget(1, 1, self.lastInput)
ftable.setWidget(2, 0, Label("Email", wordWrap=False))
self.emailInput = TextBox()
self.emailInput.addChangeListener(self.checkValid)
self.emailInput.addKeyboardListener(self)
ftable.setWidget(2, 1, self.emailInput)
ftable.setWidget(3, 0, Label("Username", wordWrap=False))
self.usernameInput = TextBox()
self.usernameInput.addChangeListener(self.checkValid)
self.usernameInput.addKeyboardListener(self)
ftable.setWidget(3, 1, self.usernameInput)
ftable.setWidget(4, 0, Label("Password", wordWrap=False))
self.passwordInput = PasswordTextBox()
self.passwordInput.addChangeListener(self.checkValid)
self.passwordInput.addKeyboardListener(self)
ftable.setWidget(4, 1, self.passwordInput)
ftable.setWidget(5, 0, Label("Confirm", wordWrap=False))
self.confirmInput = PasswordTextBox()
self.confirmInput.addChangeListener(self.checkValid)
self.confirmInput.addKeyboardListener(self)
ftable.setWidget(5, 1, self.confirmInput)
ftable.setWidget(6, 0, Label("Department", wordWrap=False))
self.departmentCombo = ListBox()
self.departmentCombo.addChangeListener(self.checkValid)
self.departmentCombo.addKeyboardListener(self)
ftable.setWidget(6, 1, self.departmentCombo)
hpanel = HorizontalPanel()
self.addBtn = Button("Add User", self.onAdd)
self.addBtn.setEnabled(False)
hpanel.add(self.addBtn)
self.cancelBtn = Button("Cancel", self.onCancel)
hpanel.add(self.cancelBtn)
ftable.setWidget(7, 0, hpanel)
ftableFormatter.setColSpan(7, 0, 2)
self.add(ftable)
return
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:58,代码来源:components.py
示例10: __init__
def __init__(self):
SimplePanel.__init__(self)
panel = AbsolutePanel(Width="100%", Height="100px")
panel.add(self.makeBox("Child 1"), 20, 10)
panel.add(self.makeBox("Child 2"), 30, 30)
self.add(panel)
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:absolutePanel.py
示例11: __init__
def __init__(self, Element=None, **kwargs):
if Element is not None:
kwargs['Element'] = Element
AbsolutePanel.__init__(self, **kwargs)
if Element is None:
# avoid having CSS styles position:relative and hidden set on body
Element = self.getBodyElement()
self.setElement(Element)
self.onAttach()
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:RootPanel.py
示例12: __init__
def __init__(self, dragController):
Example.__init__(self, dragController)
self.addStyleName(self.CSS_DEMO_ABSOLUTE_POSITION_EXAMPLE)
# use the drop target as this composite's widget
positioningDropTarget = AbsolutePanel()
positioningDropTarget.setPixelSize(400, 200)
self.setWidget(positioningDropTarget)
# instantiate our drop controller
self.absposdc = AbsolutePositionDropController(positioningDropTarget)
dragController.registerDropController(self.absposdc)
开发者ID:anandology,项目名称:pyjamas,代码行数:13,代码来源:AbsolutePositionExample.py
示例13: __init__
def __init__(self, cols, rows, width, height):
AbsolutePanel.__init__(self)
self.rows = rows
self.cols = cols
self.setStyleName("gwt-TextWindow")
DOM.setStyleAttribute(self.getElement(), 'fontFamily', 'monospace')
self.setHeight(height)
self.setWidth(width)
self.text = {}
for x in range(self.cols):
self.text[x] = {}
开发者ID:brodybits,项目名称:pyjs,代码行数:15,代码来源:textconsole.py
示例14: AppFrame
class AppFrame(object):
edit_panel = None
home_panel = None
write_panel = None
def __init__(self):
self.panel = AbsolutePanel()
self.edit_panel = EditPanel(self)
self.home_panel = HomePanel(self)
self.write_panel = WritePanel(self)
self.panel.add(self.edit_panel)
self.panel.add(self.home_panel)
self.panel.add(self.write_panel)
RootPanel().add(self.panel)
开发者ID:Afey,项目名称:pyjs,代码行数:15,代码来源:components.py
示例15: __init__
def __init__(self):
AbsolutePanel.__init__(self)
self.page=0
self.min_page=1
self.max_page=10
self.addb=Button("Next >", self)
self.subb=Button("< Prev", self)
self.g=Grid()
self.g.resize(5, 5)
self.g.setHTML(0, 0, "<b>Grid Test</b>")
self.g.setBorderWidth(2)
self.g.setCellPadding(4)
self.g.setCellSpacing(1)
self.updatePageDisplay()
self.add(self.subb)
self.add(self.addb)
self.add(self.g)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:22,代码来源:GridTest.py
示例16: __init__
def __init__(self):
SimplePanel.__init__(self)
panel = AbsolutePanel()
panel.add(self.makeBox("Child 1"), 20, 10)
panel.add(self.makeBox("Child 2"), 30, 30)
panel.setWidth("100%")
panel.setHeight("100px")
self.add(panel)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:12,代码来源:absolutePanel.py
示例17: __init__
def __init__(self):
self.state = State()
self.game_round = 0
self.TD_CONSTS = {'c3': 1., 'c2': 1., 'c1': 1., 'c6': 1., 'c5': 1., 'c4': 1.}
self.CONSTS = {'c3': .5, 'c2': 1., 'c1': 3., 'c6': .5, 'c5': .5, 'c4': .5}
self.BEST_CONSTANTS = {'c3': 0.767944, 'c2': 1.049451, 'c1': 3.074038, 'c6': 0.220823, 'c5': 0.281883, 'c4': 0.605861}
self.ONES_CONSTS = {'c3': 1., 'c2': 1., 'c1': 1., 'c6': 1., 'c5': 1., 'c4': 1.}
AbsolutePanel.__init__(self)
self.welcome_label = HTML('<H2 align="center">Welcome to Meta-Tic-Tac-Toe!</H2>To watch the AI play itself, press either "begin game" button. Note: if there is a pop-up saying that the script is taking a long time to complete, this is not a bug - the AI is just taking a while to find the next move. Select the option to continue the script.', StyleName='margins_both')
self.add(self.welcome_label)
self.depth_limit = 2
self.train_td = Button("Begin game. Learning AI first!", self, StyleName='margins_left')
self.add(self.train_td)
self.train_static = Button("Begin game. Static AI first!", self, StyleName='margins_left')
self.add(self.train_static)
self.score_label = Label("CURRENT SCORE: Learning AI: %d | Static AI: %d"% (0,0), StyleName='margins_left')
self.add(self.score_label)
self.game_over_message = Label("", StyleName='margins_left')
self.add(self.game_over_message)
StyleSheetCssText(margins)
self.increase_depth = Button("Increase ply search depth.", self)
self.decrease_depth = Button("Decrease ply search depth.", self)
self.depth_label = Label("Current depth is " + str(self.depth_limit) +".")
self.depth_grid = Grid(StyleName='margins_left')
self.depth_grid.resize(1, 3)
self.depth_grid.setBorderWidth(2)
self.depth_grid.setCellPadding(9)
self.depth_grid.setCellSpacing(1)
self.add(self.depth_grid)
self.depth_grid.setWidget(0, 0, self.decrease_depth)
self.depth_grid.setWidget(0, 1, self.depth_label)
self.depth_grid.setWidget(0, 2, self.increase_depth)
# initialize the board grid:
self.g=Grid(StyleName='margins_left')
self.g.resize(3, 3)
self.g.setBorderWidth(2)
self.g.setCellPadding(9)
self.g.setCellSpacing(1)
self.init()
self.add(self.g)
# initialize the contstants adjustment grid:
self.adj_grid = Grid(StyleName='margins_left')
self.adj_grid.resize(7, 4)
self.adj_grid.setBorderWidth(2)
self.adj_grid.setCellPadding(9)
self.adj_grid.setCellSpacing(1)
self.init_constants_adj_grid()
self.add(self.adj_grid)
self.reset_constants = Button("Reset all of Learning AI's constants to 1.", self, StyleName='margins_left')
self.add(self.reset_constants)
self.state_to_grid()
开发者ID:chetweger,项目名称:min-max-games,代码行数:63,代码来源:LearnMeta.py
示例18: getElement
def getElement(self, index=None):
if index is None:
return AbsolutePanel.getElement(self)
return self.getWidget(index).getElement()
开发者ID:,项目名称:,代码行数:4,代码来源:
示例19: __init__
def __init__(self):
self.state = State()
self.game_over = False
self.TD_CONSTS = {'c3': 0.767944, 'c2': 1.049451, 'c1': 3.074038, 'c6': 0.220823, 'c5': 0.281883, 'c4': 0.605861}
AbsolutePanel.__init__(self)
StyleSheetCssText(margins) # initialize css...
self.welcome_label = HTML('<H2 align="center">Welcome to Meta-Tic-Tac-Toe!</H2><p>Play first by clicking on one of the positions in the middle board or let the AI go first by clicking on "AI first". To change the difficulty click on "Increase/Decrease search depth". Note: if there is a pop-up saying that the script is taking a long time to complete, this is not a bug - the AI is just taking a while to find the next move. Select the option to continue the script.</p>', StyleName='margins_both')
self.add(self.welcome_label)
self.depthLimit = 3
self.human_first = True
self.ai_first = Button("AI first.", self, StyleName='margins_left')
self.add(self.ai_first)
self.increase_depth = Button("Increase search depth", self)
self.decrease_depth = Button("Decrease search depth", self)
self.depth_label = HTML("""AI will search to a <a href="#depth_explanation">depth</a> of """ + str(self.depthLimit) +".")
self.depth_grid = Grid(StyleName='margins_left')
self.depth_grid.resize(1, 3)
self.depth_grid.setBorderWidth(2)
self.depth_grid.setCellPadding(9)
self.depth_grid.setCellSpacing(1)
self.add(self.depth_grid)
self.depth_grid.setWidget(0, 0, self.decrease_depth)
self.depth_grid.setWidget(0, 1, self.depth_label)
self.depth_grid.setWidget(0, 2, self.increase_depth)
self.new_game = Button("New game", self, StyleName='margins_left')
self.add(self.new_game)
self.score_label = Label("CURRENT SCORE: Human: %d | AI: %d"% (0,0), StyleName='margins_left')
self.add(self.score_label)
self.game_over_msg = HTML("", StyleName='margins_left')
self.add(self.game_over_msg)
# initialize the board grid:
self.g=Grid(StyleName='margins_left')
self.g.resize(3, 3)
self.g.setBorderWidth(2)
self.g.setCellPadding(9)
self.g.setCellSpacing(1)
self.init()
self.add(self.g)
# initialize the contstants adjustment grid:
self.adj_grid = Grid(StyleName='margins_left')
self.adj_grid.resize(7, 3)
self.adj_grid.setBorderWidth(2)
self.adj_grid.setCellPadding(9)
self.adj_grid.setCellSpacing(1)
self.init_constants_adj_grid()
self.add(self.adj_grid)
self.max_player = '-1'
self.min_player = '-1'
self.state_to_grid()
开发者ID:chetweger,项目名称:min-max-games,代码行数:61,代码来源:Meta.py
示例20: onAttach
def onAttach(self):
AbsolutePanel.onAttach(self)
self.setSplitPosition()
开发者ID:,项目名称:,代码行数:3,代码来源:
注:本文中的pyjamas.ui.AbsolutePanel.AbsolutePanel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论