本文整理汇总了Python中pyjamas.ui.Grid.Grid类的典型用法代码示例。如果您正苦于以下问题:Python Grid类的具体用法?Python Grid怎么用?Python Grid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Grid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, grid_size):
Grid.__init__(self)
# populate the grid with some stuff
#
self.resize(grid_size, grid_size)
self.setBorderWidth(2)
self.setCellPadding(4)
self.setCellSpacing(1)
self.setStyleName("gameboard") # just doesn't work
# Set up game board
#
# Note that must iterate over indices, rather than Cell
# instances, until the table positions are set up here
#
index = 0 # debug
for i in range(grid_size):
for j in range(grid_size):
cell = HTML(SPACE)
# cell.setVisible(False) # causes to ignore click events
cell.position = (i, j) # might be handy at some point
index+=1; cell.index = index # debug
# cell.setStyleName("cell_O")
cell.addClickListener(getattr(self, "onCellClicked"))
self.setWidget(i, j, cell)
开发者ID:tmst,项目名称:Tic-Tac-Toe,代码行数:28,代码来源:tictactoe.py
示例2: __init__
def __init__(self, query, nUsers, tabName, popup, preparePanel, topPanel):
Grid.__init__(self, 3, 2)
self.tweet = text.TextAreaFocusHighlight(
Text="Tickery query %r has %d results. See them at" % (
query, nUsers),
VisibleLines=3, MaxLength=1000, StyleName='large-query-area')
self.tweet.addKeyboardListener(self)
self.query = query
self.tabName = tabName
self.popup = popup
self.preparePanel = preparePanel
self.topPanel = topPanel
self.button = Button('Tweet!', self)
self.count = Label('')
self.setWidget(0, 0, HTML(_instructions))
self.setWidget(0, 1, self.count)
self.setWidget(1, 0, self.tweet)
self.setWidget(1, 1, self.button)
formatter = self.getCellFormatter()
formatter.setVerticalAlignment(0, 1, 'bottom')
formatter.setVerticalAlignment(1, 1, 'bottom')
self.setCount()
开发者ID:jdunck,项目名称:Tickery,代码行数:25,代码来源:tweet.py
示例3: TickeryTab
class TickeryTab(VerticalPanel):
process = None # Define in subclass.
def __init__(self, topPanel, **kwargs):
VerticalPanel.__init__(self,
HorizontalAlignment=HasAlignment.ALIGN_LEFT,
StyleName='tickery-tab',
**kwargs)
self.topPanel = topPanel # don't add this yet!
self.topGrid = Grid(1, 2, StyleName='tickery-tab-top-grid',
HorizontalAlignment=HasAlignment.ALIGN_LEFT)
self.add(self.topGrid)
self.autoActivate = False
def addTopPanel(self):
parent = self.topPanel.getParent()
if parent:
parent.remove(self.topPanel)
self.topGrid.setWidget(0, 0, self.topPanel)
formatter = self.topGrid.getCellFormatter()
formatter.setAlignment(0, 0, 'left', 'top')
formatter.setAlignment(0, 1, 'left', 'top')
formatter.setWidth(0, 1, '100%')
def onTimer(self, timerid):
self.setInputFocus()
if self.autoActivate:
self.autoActivate = False
self.process()
开发者ID:jdunck,项目名称:Tickery,代码行数:30,代码来源:tickerytab.py
示例4: __init__
def __init__(self, loginPanel):
Grid.__init__(self, 1, 1, StyleName="top-panel")
self.loginPanel = loginPanel
self.banner = banner.Banner()
self.setWidget(0, 0, self.banner)
formatter = self.getCellFormatter()
formatter.setHorizontalAlignment(0, 0, "left")
formatter.setVerticalAlignment(0, 0, "top")
开发者ID:jdunck,项目名称:Tickery,代码行数:8,代码来源:toppanel.py
示例5: start_game
def start_game(self):
dim = self.level
grid = Grid(dim,dim)
grid.setStyleName("grid")
for i in range(dim):
for j in range(dim):
gc = GridCell(i,j)
grid.setWidget(i,j,gc)
self.add(grid)
开发者ID:jaredly,项目名称:pyjamas,代码行数:9,代码来源:lightout.py
示例6: make_panel
def make_panel(self):
message = Label(
'The configuration has been changed.\n'
'You must apply the changes in order for them to take effect.')
DOM.setStyleAttribute(message.getElement(), "whiteSpace", 'pre')
msgbox = Grid(1, 2, StyleName='changes')
msgbox.setWidget(0, 0, Image('icons/exclam.png'))
msgbox.setWidget(0, 1, message)
msgbox.getCellFormatter().setStyleName(0, 0, 'changes-image')
msgbox.getCellFormatter().setStyleName(0, 1, 'changes-text')
button = Button('apply changes')
button.addClickListener(self.apply_clicked)
self.changes = VerticalPanel()
self.changes.setHorizontalAlignment('right')
self.changes.setVisible(False)
self.changes.add(msgbox)
self.changes.add(button)
panel = VerticalPanel()
panel.setSpacing(10)
panel.add(self.table)
panel.add(self.status)
panel.add(self.changes)
return panel
开发者ID:christophgysin,项目名称:schoolbell,代码行数:28,代码来源:alarmwidget.py
示例7: start_game
def start_game(self, level=None):
if level is not None:
self.level = level
dim = self.level
grid = Grid(dim,dim)
grid.setStyleName("grid")
for i in range(dim):
for j in range(dim):
gc = GridCell(i,j)
grid.setWidget(i,j,gc)
self.add(grid)
开发者ID:Afey,项目名称:pyjs,代码行数:11,代码来源:lightout.py
示例8: __init__
def __init__(self, **kwargs):
DockPanel.__init__(self, **kwargs)
self.grid = Grid(StyleName="datagrid")
self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
self.header = Grid(Height="50px")
self.add(self.header, DockPanel.NORTH)
self.add(self.sp, DockPanel.CENTER)
cf = self.setCellHeight(self.header, "50px")
cf = self.setCellHeight(self.sp, "100%")
self.sortcol = 0
开发者ID:Afey,项目名称:pyjs,代码行数:11,代码来源:SortedGridThing.py
示例9: OddGridWidget
class OddGridWidget(DockPanel):
def __init__(self, **kwargs):
DockPanel.__init__(self, **kwargs)
self.grid = Grid(StyleName="datagrid")
self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
self.header = Grid(Height="50px")
self.add(self.header, DockPanel.NORTH)
self.add(self.sp, DockPanel.CENTER)
cf = self.setCellHeight(self.header, "50px")
cf = self.setCellHeight(self.sp, "100%")
self.sortcol = 0
def setData(self, data):
self.data = data
self.redraw()
def sortfn(self, row1, row2):
return cmp(row1[self.sortcol], row2[self.sortcol])
def redraw(self):
self.data.sort(self.sortfn)
rows = len(self.data)
cols = 0
if rows > 0:
cols = len(self.data[0])
self.grid.resize(rows, cols)
self.header.resize(1, cols)
cf = self.grid.getCellFormatter()
for (nrow, row) in enumerate(self.data):
for (ncol, item) in enumerate(row):
self.grid.setHTML(nrow, ncol, str(item))
cf.setWidth(nrow, ncol, "200px")
cf = self.header.getCellFormatter()
self.sortbuttons = []
for ncol in range(cols):
sb = Button("sort col %d" % ncol)
sb.addClickListener(self)
self.header.setWidget(0, ncol, sb)
cf.setWidth(0, ncol, "200px")
self.sortbuttons.append(sb)
def onClick(self, sender):
for (ncol, b) in enumerate(self.sortbuttons):
if sender == b:
self.sortcol = ncol
self.redraw()
开发者ID:Afey,项目名称:pyjs,代码行数:53,代码来源:SortedGridThing.py
示例10: __init__
def __init__(self):
SimplePanel.__init__(self)
grid = Grid(5, 5,
BorderWidth=2,
CellPadding=4,
CellSpacing=1)
grid.setHTML(0, 0, '<b>Hello, World!</b>')
for row in range(1, 5):
for col in range(1, 5):
grid.setText(row, col, str(row) + "*" + str(col) + " = " + str(row*col))
self.add(grid)
开发者ID:Afey,项目名称:pyjs,代码行数:14,代码来源:grid.py
示例11: __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,代码来源:
示例12: __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
示例13: __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
示例14: __init__
def __init__(self):
Grid.__init__(self)
self.targets=[]
self.targets.append("app")
#self.targets.append("ui")
self.resize(len(self.targets)+1, 2)
self.setBorderWidth("1px")
self.counter=0
self.setHTML(0, 0, "<b>Log</b>")
self.setText(1, 0, "app")
for i in range(len(self.targets)):
target=self.targets[i]
self.setText(i+1, 0, target)
开发者ID:Afey,项目名称:pyjs,代码行数:16,代码来源:MailLogger.py
示例15: __init__
def __init__(self, hendler = None):
VerticalPanel.__init__(self,
#HorizontalAlignment=HasAlignment.ALIGN_CENTER,
#VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
Width="100%",
#Height="100%",
Spacing=5)
self.remote = DataService(['getaccounts'])
self.grid = Grid(1, 3,
BorderWidth=1,
CellPadding=4,
CellSpacing=1,
StyleName="grid")
self.grid.setText(0, 0, u"Number")
self.grid.setText(0, 1, u"Type")
self.grid.setText(0, 2, u"Balance")
formatter = self.grid.getRowFormatter()
formatter.setStyleName(0, "grid-header")
self.add(Label(u"Accounts"))
self.add(self.grid)
开发者ID:fedenko,项目名称:clientbank,代码行数:25,代码来源:AccountListSink.py
示例16: onModuleLoad
def onModuleLoad(self):
## Grid setup
self.grid = Grid()
# Note: The resize method args are Rows,Cols (Curses style)
self.grid.resize(1,4)
self.grid.setBorderWidth(1)
self.grid.setHTML(0,0,'#')
self.grid.setHTML(0,1,'ID')
self.grid.setHTML(0,2,'Revision')
self.grid.setHTML(0,3,'Delete')
self.grid.addTableListener(self)
self.parent_panel.add(self.grid)
## Buttons
self.button_panel = HorizontalPanel()
# Prev
self.first_button = Button("<-", self.firstPage)
self.first_button.setEnabled(False)
self.button_panel.add(self.first_button)
self.prev_button = Button("Previous", self.prevPage)
self.prev_button.setEnabled(False)
self.button_panel.add(self.prev_button)
self.next_button = Button("Next", self.nextPage)
self.next_button.setEnabled(False)
self.button_panel.add(self.next_button)
self.parent_panel.add(self.button_panel)
开发者ID:CodeSturgeon,项目名称:slipcover,代码行数:27,代码来源:viewer.py
示例17: __init__
def __init__(self):
Logger.instances.append(self)
Grid.__init__(self, Visible=False)
self.targets=[]
self.targets.append("app")
#self.targets.append("ui")
self.resize(len(self.targets)+1, 2)
self.setBorderWidth("1")
self.counter=0
self.setHTML(0, 0, "<b>Log</b>")
self.setText(1, 0, "app")
for i in range(len(self.targets)):
target=self.targets[i]
self.setText(i+1, 0, target)
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:17,代码来源:Logger.py
示例18: DynaTableWidget
class DynaTableWidget(Composite):
def __init__(self, provider, columns, columnStyles, rowCount):
Composite.__init__(self)
self.acceptor = RowDataAcceptorImpl(self)
self.outer = DockPanel()
self.startRow = 0
self.grid = Grid()
self.navbar = NavBar(self)
self.provider = provider
self.initWidget(self.outer)
self.grid.setStyleName("table")
self.outer.add(self.navbar, DockPanel.NORTH)
self.outer.add(self.grid, DockPanel.CENTER)
self.initTable(columns, columnStyles, rowCount)
self.setStyleName("DynaTable-DynaTableWidget")
def initTable(self, columns, columnStyles, rowCount):
self.grid.resize(rowCount + 1, len(columns))
for i in range(len(columns)):
self.grid.setText(0, i, columns[i])
if columnStyles:
self.grid.cellFormatter.setStyleName(0, i, columnStyles[i] + "header")
def setStatusText(self, text):
self.navbar.status.setText(text)
def clearStatusText(self, text):
self.navbar.status.setHTML(" ")
def refresh(self):
self.navbar.gotoFirst.setEnabled(False)
self.navbar.gotoPrev.setEnabled(False)
self.navbar.gotoNext.setEnabled(False)
self.setStatusText("Please wait...")
self.provider.updateRowData(self.startRow, self.grid.getRowCount() - 1, self.acceptor)
def setRowCount(self, rows):
self.grid.resizeRows(rows)
def getDataRowCount(self):
return self.grid.getRowCount() - 1
开发者ID:Afey,项目名称:pyjs,代码行数:45,代码来源:DynaTableWidget.py
示例19: __init__
def __init__(self):
Sink.__init__(self)
inner = Grid(10, 5, Width="100%", BorderWidth="1")
outer = FlexTable(Width="100%", BorderWidth="1")
outer.setWidget(0, 0, Image(self.baseURL() + "rembrandt/LaMarcheNocturne.jpg"))
outer.getFlexCellFormatter().setColSpan(0, 0, 2)
outer.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER)
outer.setHTML(1, 0, "Look to the right...<br>That's a nested table component ->")
outer.setWidget(1, 1, inner)
outer.getCellFormatter().setColSpan(1, 1, 2)
for i in range(10):
for j in range(5):
inner.setText(i, j, "%d" % i + ",%d" % j)
self.initWidget(outer)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:18,代码来源:Tables.py
示例20: __init__
def __init__(self, topPanel, **kwargs):
VerticalPanel.__init__(self,
HorizontalAlignment=HasAlignment.ALIGN_LEFT,
StyleName='tickery-tab',
**kwargs)
self.topPanel = topPanel # don't add this yet!
self.topGrid = Grid(1, 2, StyleName='tickery-tab-top-grid',
HorizontalAlignment=HasAlignment.ALIGN_LEFT)
self.add(self.topGrid)
self.autoActivate = False
开发者ID:jdunck,项目名称:Tickery,代码行数:10,代码来源:tickerytab.py
注:本文中的pyjamas.ui.Grid.Grid类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论