本文整理匯總了Python中graphics.Graphics.add_entry方法的典型用法代碼示例。如果您正苦於以下問題:Python Graphics.add_entry方法的具體用法?Python Graphics.add_entry怎麽用?Python Graphics.add_entry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphics.Graphics
的用法示例。
在下文中一共展示了Graphics.add_entry方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_graphics
# 需要導入模塊: from graphics import Graphics [as 別名]
# 或者: from graphics.Graphics import add_entry [as 別名]
def get_graphics(self):
graphics = Graphics()
email_address = self._task_master.read_task_data(EMAIL_UID)
url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
self._uri[0])
graphics.add_uri('file://' + url, height=self._height)
graphics.set_zoom_level(self._zoom_level)
if email_address is not None:
self._entry[0] = graphics.add_entry(text=email_address)
else:
self._entry[0] = graphics.add_entry()
self._entry[0].connect('activate', self._enter_entered)
phone_number = self._task_master.read_task_data(PHONE_NUMBER_UID)
url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
self._uri[1])
graphics.add_uri('file://' + url, height=self._height)
graphics.set_zoom_level(self._zoom_level)
if phone_number is not None:
self._entry[1] = graphics.add_entry(text=phone_number)
else:
self._entry[1] = graphics.add_entry()
return graphics, self._prompt
示例2: Support5Task
# 需要導入模塊: from graphics import Graphics [as 別名]
# 或者: from graphics.Graphics import add_entry [as 別名]
#.........這裏部分代碼省略.........
button.destroy()
elif len(self._results) < 10:
for button in self._buttons:
button.destroy()
self._make_buttons(self._results)
def _school_entry_press_cb(self, widget, event):
if not self._is_valid_postal_code_entry():
return
self._results = self._completer.complete(
widget.get_text() + Gdk.keyval_name(event.keyval), 0)
def _yes_no_cb(self, widget, arg):
if arg == 'yes':
self._task_master.write_task_data(SCHOOL_UID, None)
school = self._school_entry.get_text()
postal_code = self._postal_code_entry.get_text()
self._task_master.write_task_data(self.uid, self._task_data)
self._task_master.write_task_data(SCHOOL_NAME, school)
self._task_master.write_task_data(POST_CODE, postal_code)
self._task_master.write_task_data(SCHOOL_UID, self._default_sf_id)
self._task_master.current_task += 1
self._task_master.write_task_data('current_task',
self._task_master.current_task)
self._task_master.task_master()
def after_button_press(self):
school = self._school_entry.get_text()
if school in self._schools:
i = self._schools.index(school)
self._task_master.write_task_data(SCHOOL_UID, self._sf_ids[i])
self._task_master.write_task_data(SCHOOL_NAME, school)
return True
else:
# Confirm that it is OK to use a school not in the list.
self._task_master.task_button.hide()
self._graphics.add_text(_('Your school does not appear in our '
'list of schools in Australia. '
'OK to continue?'))
self._graphics.add_yes_no_buttons(self._yes_no_cb)
return False
def get_graphics(self):
self._graphics = Graphics()
url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
self._uri[0])
self._graphics.add_uri('file://' + url, height=self._height)
self._graphics.set_zoom_level(self._zoom_level)
target = self._task_master.read_task_data(POST_CODE)
if target is not None and \
self._is_valid_postal_code_entry(target=target):
self._postal_code_entry = self._graphics.add_entry(text=target)
else:
self._postal_code_entry = self._graphics.add_entry()
self._postal_code_entry.connect('key-release-event',
self._postal_code_entry_cb)
self._postal_code_entry.connect('key-press-event',
self._postal_code_entry_cb)
self._postal_code_entry.connect('activate',
self._postal_code_enter_entered)
url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
self._uri[1])
self._graphics.add_uri('file://' + url, height=self._height)
self._graphics.set_zoom_level(self._zoom_level)
target = self._task_master.read_task_data(SCHOOL_NAME)
if target is not None:
self._school_entry = self._graphics.add_entry(text=target)
else:
self._school_entry = self._graphics.add_entry()
self._school_entry.connect('key-release-event',
self._school_entry_release_cb)
self._school_entry.connect('key-press-event',
self._school_entry_press_cb)
self._school_entry.connect('focus-in-event',
self._school_entry_focus_cb)
self._school_entry.connect('activate', self._school_enter_entered)
self._postal_code_entry.grab_focus()
return self._graphics, self._prompt
def grab_focus(self):
self._postal_code_entry.set_can_focus(True)
self._school_entry.set_can_focus(True)
if len(self._postal_code_entry.get_text()) < 3:
self._task_master.activity.set_copy_widget(
text_entry=self._postal_code_entry)
self._task_master.activity.set_paste_widget(
text_entry=self._postal_code_entry)
else:
self._task_master.activity.set_copy_widget(
text_entry=self._school_entry)
self._task_master.activity.set_paste_widget(
text_entry=self._school_entry)