本文整理汇总了Python中pyjamas.ui.Image.Image.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Python Image.setTitle方法的具体用法?Python Image.setTitle怎么用?Python Image.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.Image.Image
的用法示例。
在下文中一共展示了Image.setTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_footer
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import setTitle [as 别名]
def make_footer(self):
self.time = {}
self.time['hour'] = ListBox()
self.time['hour'].setVisibleItemCount(1)
for hour in range(24):
self.time['hour'].addItem('%02d' % hour)
self.time['hour'].setSelectedIndex(12)
self.time['minute'] = ListBox()
self.time['minute'].setVisibleItemCount(1)
for minute in range(0, 60, 5):
self.time['minute'].addItem('%02d' % minute)
self.time['minute'].setSelectedIndex(0)
time_panel = HorizontalPanel()
time_panel.setVerticalAlignment('center')
time_panel.add(self.time['hour'])
time_panel.add(Label(':'))
time_panel.add(self.time['minute'])
self.table.setWidget(1, 0, time_panel)
weekdays_panel = HorizontalPanel()
weekdays_panel.setSpacing(5)
self.weekdays = {}
for i in range(7):
self.weekdays[i] = CheckBox(AlarmWidget.weekday_name[i])
self.weekdays[i].setChecked(i < 6)
weekdays_panel.add(self.weekdays[i])
self.table.setWidget(1, 1, weekdays_panel)
self.duration = ListBox()
self.duration.setVisibleItemCount(1)
choices = [ 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60 ]
for seconds in choices:
self.duration.addItem(
'%ds' % seconds if seconds < 60 else '%dm' % (seconds / 60),
seconds)
self.duration.setSelectedIndex(2)
self.table.setWidget(1, 2, self.duration)
image = Image('icons/plus.png')
image.setTitle('add');
image.addClickListener(self.plus_clicked)
self.table.setWidget(1, 3, image)
for col in range(4):
self.table.getCellFormatter().setStyleName(1, col, 'tablecell noborder')
示例2: add
# 需要导入模块: from pyjamas.ui.Image import Image [as 别名]
# 或者: from pyjamas.ui.Image.Image import setTitle [as 别名]
def add(self, time, weekdays=range(5), duration=3):
row = self.table.getRowCount()-1
self.table.insertRow(row)
self.table.setText(row, 0, time)
weekdays_str = []
for weekday in weekdays:
weekdays_str.append(AlarmWidget.weekday_name[weekday])
self.table.setText(row, 1, ', '.join(weekdays_str))
self.table.setText(row, 2, str(duration) + 's')
image = Image('icons/x.png')
image.setTitle('delete');
image.addClickListener(lambda x: self.x_clicked(row-1))
self.table.setWidget(row, 3, image)
for col in range(3):
self.table.getCellFormatter().setStyleName(row, col, 'tablecell')
self.table.getCellFormatter().setStyleName(row, 3, 'tablecell noborder')