本文整理汇总了Python中pygame.font.get_fonts函数的典型用法代码示例。如果您正苦于以下问题:Python get_fonts函数的具体用法?Python get_fonts怎么用?Python get_fonts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_fonts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_match_font_all_exist
def test_match_font_all_exist(self):
fonts = pygame_font.get_fonts()
# Ensure all listed fonts are in fact available, and the returned file
# name is a full path.
for font in fonts:
path = pygame_font.match_font(font)
self.failIf(path is None)
self.failUnless(os.path.isabs(path))
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:9,代码来源:font_test.py
示例2: test_match_font_italic
def test_match_font_italic(self):
fonts = pygame_font.get_fonts()
# Look for an italic font.
for font in fonts:
if pygame_font.match_font(font, italic=True) is not None:
break
else:
self.fail()
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:10,代码来源:font_test.py
示例3: test_match_font_bold
def test_match_font_bold(self):
fonts = pygame_font.get_fonts()
# Look for a bold font.
for font in fonts:
if pygame_font.match_font(font, bold=True) is not None:
break
else:
self.fail()
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:10,代码来源:font_test.py
示例4: test_SysFont
def test_SysFont(self):
# Can only check that a font object is returned.
fonts = pygame_font.get_fonts()
o = pygame_font.SysFont(fonts[0], 20)
self.failUnless(isinstance(o, pygame_font.FontType))
o = pygame_font.SysFont(fonts[0], 20, italic=True)
self.failUnless(isinstance(o, pygame_font.FontType))
o = pygame_font.SysFont(fonts[0], 20, bold=True)
self.failUnless(isinstance(o, pygame_font.FontType))
o = pygame_font.SysFont('thisisnotafont', 20)
self.failUnless(isinstance(o, pygame_font.FontType))
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:11,代码来源:font_test.py
示例5: test_match_font_comma_separated
def test_match_font_comma_separated(self):
fonts = pygame_font.get_fonts()
# Check for not found.
self.failUnless(pygame_font.match_font('thisisnotafont') is None)
# Check comma separated list.
names = ','.join(['thisisnotafont', fonts[-1], 'anothernonfont'])
self.failIf(pygame_font.match_font(names) is None)
names = ','.join(['thisisnotafont1', 'thisisnotafont2', 'thisisnotafont3'])
self.failUnless(pygame_font.match_font(names) is None)
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:12,代码来源:font_test.py
示例6: test_get_fonts
def test_get_fonts(self):
fnts = pygame_font.get_fonts()
if not fnts:
raise Exception(repr(fnts))
self.failUnless(fnts)
if (PY_MAJOR_VERSION >= 3):
# For Python 3.x, names will always be unicode strings.
name_types = (str,)
else:
# For Python 2.x, names may be either unicode or ascii strings.
name_types = (str, unicode)
for name in fnts:
# note, on ubuntu 2.6 they are all unicode strings.
self.failUnless(isinstance(name, name_types), name)
self.failUnless(name.islower(), name)
self.failUnless(name.isalnum(), name)
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:21,代码来源:font_test.py
示例7: test_get_fonts
def test_get_fonts(self):
fnts = pygame_font.get_fonts()
if not fnts:
raise Exception(repr(fnts))
self.failUnless(fnts)
# strange python 2.x bug... if you assign to unicode,
# all sorts of weirdness happens.
if sys.version_info <= (3, 0, 0):
unicod = unicode
else:
unicod = str
for name in fnts:
# note, on ubuntu 2.6 they are all unicode strings.
self.failUnless(isinstance(name, (str, unicod)), name)
self.failUnless(name.islower(), name)
self.failUnless(name.isalnum(), name)
开发者ID:CMPUT274-Project,项目名称:Assignment_4,代码行数:21,代码来源:font_test.py
示例8: build
def build(self):
b = BoxLayout(orientation='vertical')
languages = Spinner(
text='language',
values=sorted(['KvLexer', ] + list(lexers.LEXERS.keys())))
languages.bind(text=self.change_lang)
menu = BoxLayout(
size_hint_y=None,
height='30pt')
fnt_size = Spinner(
text='12',
values=list(map(str, list(range(5, 40)))))
fnt_size.bind(text=self._update_size)
fnt_name = Spinner(
text='DroidSansMono',
option_cls=Fnt_SpinnerOption,
values=sorted(map(str, fonts.get_fonts())))
fnt_name.bind(text=self._update_font)
mnu_file = Spinner(
text='File',
values=('Open', 'SaveAs', 'Save', 'Close'))
mnu_file.bind(text=self._file_menu_selected)
menu.add_widget(mnu_file)
menu.add_widget(fnt_size)
menu.add_widget(fnt_name)
menu.add_widget(languages)
b.add_widget(menu)
self.codeinput = CodeInput(
lexer=KivyLexer(),
font_name='data/fonts/DroidSansMono.ttf', font_size=12,
text=example_text)
b.add_widget(self.codeinput)
return b
开发者ID:4johndoe,项目名称:kivy,代码行数:39,代码来源:codeinput.py
示例9: __init__
def __init__(self, **kwargs):
super(FontChooser, self).__init__(**kwargs)
self.orientation = "vertical"
self.fonts = sorted(map(str, fonts.get_fonts()))
data = [{'text': str(i), 'is_selected': i == self.font} for i in self.fonts]
args_converter = lambda row_index, rec: {'text': rec['text'],
'size_hint_y': None,
'height': 25}
self.list_adapter = ListAdapter(data=data, args_converter=args_converter, cls=ListItemButton, selection_mode='single', allow_empty_selection=False)
self.list_view = ListView(adapter=self.list_adapter)
self.list_adapter.bind(selection=self.on_font_select)
self.label = Label(text="The quick brown fox jumps over the brown lazy dog. 0123456789", font_size="30dp", halign="center", size_hint_y=None)
self.label.font_name = fonts.match_font(self.list_adapter.selection[0].text)
self.label.bind(size=self.label.setter("text_size"))
self.font = self.list_adapter.selection[0].text
self.add_widget(self.list_view)
self.add_widget(self.label)
开发者ID:Davideddu,项目名称:karaokivy,代码行数:22,代码来源:ui.py
示例10: test_get_fonts_returns_something
def test_get_fonts_returns_something(self):
fnts = pygame_font.get_fonts()
self.failUnless(fnts)
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:3,代码来源:font_test.py
示例11: sorted
try:
import numpy
HAS_NUMPY = True
except ImportError:
HAS_NUMPY = False
try:
import PIL
HAS_PIL = True
except ImportError:
HAS_PIL = False
CAN_SHADOWS = HAS_NUMPY and HAS_PIL
# fonts
AVAILABLE_FONTS = sorted(get_fonts())
# pygame events
EVENT_QUIT = pygame_event.Event(QUIT)
THORPY_EVENT = USEREVENT
# events types : these are the names of thorpy events.
# A ThorPy event has an attribute name, and the numbers below are these attributes, not pygame events!!!
# However, due to the working principle of Reactions, we follow the numbers after pygame.USEREVENT
EVENT_TIME = 1
EVENT_PRESS = 2 # posted when an element enter state pressed
# posted when sth has been inserted into an Inserter
EVENT_INSERT = 3
EVENT_SELECT = 4 # posted when sth has been selected into a DDL
# posted when mousewheel has been used on an element that handles it
EVENT_WHEEL = 5
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:31,代码来源:constants.py
示例12: installed
def installed(cls):
if not cls._sort: cls._sort = sorted(pf.get_fonts())
return cls._sort
开发者ID:dmaccarthy,项目名称:sc8pr,代码行数:3,代码来源:text.py
示例13: find_fonts
def find_fonts():
monospaced = ["bitstreamverasansmono", "consolas", "luximono", "lucidaconsole", "andalemono", "couriernew", 'inconsolata', 'courier', 'monaco']
return sorted([f for f in font.get_fonts() if f in monospaced])
开发者ID:jennazee,项目名称:Synesthesia,代码行数:3,代码来源:synesthesizer.py
示例14: build
def build(self):
self.robot = Robot(status_display=self, code_display=self,
on_disconnect=self._on_disconnect,
on_stiffness=self._on_chain_stiffness_from_robot)
# building Kivy Interface
b = BoxLayout(orientation='vertical')
menu = BoxLayout(
size_hint_y=None,
height='30pt')
fnt_name = Spinner(
text='DroidSansMono',
option_cls=Fnt_SpinnerOption,
values=sorted(map(str, fonts.get_fonts())))
fnt_name.bind(text=self._update_font)
# file menu
mnu_file = Spinner(
text=localized_text('file_menu_title'),
values=(localized_text('file_connect'),
localized_text('file_open'),
localized_text('file_save_as'),
localized_text('file_save'),
localized_text('file_close')))
mnu_file.bind(text=self._file_menu_selected)
# motors on/off
btn_motors = ToggleButton(text=localized_text('motors_on'),
state='normal',
background_down='stiff.png',
background_normal='relaxed.png')
btn_motors.bind(on_press=self._on_motors)
self._motor_toggle_button = btn_motors
btn_speech = ToggleButton(text=localized_text('speech_recognition'),
state='down' if self.robot.is_speech_recognition_enabled else 'normal')
btn_speech.bind(on_press=self._on_toggle_speech_recognition)
btn_touch_sensors = ToggleButton(text=localized_text('touch_sensors'),
state='down' if self.robot.is_touch_sensors_enabled else 'normal')
btn_touch_sensors.bind(on_press=self._on_toggle_touch_sensors)
# run script
btn_run_script = Button(text=localized_text('run_script'))
btn_run_script.bind(on_press=self._on_run_script)
self.btn_run_script = btn_run_script
# root actions menu
robot_actions = Spinner(
text=localized_text('action_menu_title'),
values=sorted(self.robot.postures()))
robot_actions.bind(text=self.on_action)
# add to menu
menu.add_widget(mnu_file)
menu.add_widget(btn_speech)
menu.add_widget(btn_touch_sensors)
menu.add_widget(btn_motors)
menu.add_widget(btn_run_script)
menu.add_widget(robot_actions)
b.add_widget(menu)
controls = BoxLayout(
size_hint_y=None,
height='30pt')
# add keyframe
btn_add_keyframe = Button(text=localized_text('add_keyframe'))
btn_add_keyframe.bind(on_press=self._on_add_keyframe)
controls.add_widget(btn_add_keyframe)
# set read joint angles to enable animation to start from known position
btn_update_joints = Button(text=localized_text('read_joints'))
btn_update_joints.bind(on_press=self._on_read_joints)
controls.add_widget(btn_update_joints)
kf_duration_label = Label(text=localized_text('keyframe_duration_colon'))
controls.add_widget(kf_duration_label)
kf_duration_input = TextInput(text=str(self.robot.keyframe_duration), multiline=False)
kf_duration_input.bind(text=self._on_keyframe_duration)
controls.add_widget(kf_duration_input)
# allow user to select which translator to use
active_translator = Spinner(
text=self.robot.get_translator_name(),
values=get_translator_names())
active_translator.bind(text=self._on_translator_changed)
controls.add_widget(active_translator)
self.active_translator = active_translator
self.is_translator_cancel = False
b.add_widget(controls)
m = BoxLayout()
code_status = BoxLayout(orientation='vertical', size_hint=(0.6, 1))
# code input
self.codeinput = CodeInput(
#.........这里部分代码省略.........
开发者ID:davesnowdon,项目名称:nao-recorder,代码行数:101,代码来源:main.py
示例15: build
def build(self):
self.robot = Robot(status_display=self, code_display=self)
# building Kivy Interface
b = BoxLayout(orientation='vertical')
menu = BoxLayout(
size_hint_y=None,
height='30pt')
fnt_name = Spinner(
text='DroidSansMono',
option_cls=Fnt_SpinnerOption,
values=sorted(map(str, fonts.get_fonts())))
fnt_name.bind(text=self._update_font)
# file menu
mnu_file = Spinner(
text='File',
values=('Connect', 'Open', 'SaveAs', 'Save', 'Close'))
mnu_file.bind(text=self._file_menu_selected)
# motors on/off
btn_motors_on = Button(text='Motors On')
btn_motors_on.bind(on_press=self._on_motors_on)
btn_motors_off = Button(text='Motors Off')
btn_motors_off.bind(on_press=self._on_motors_off)
# run script
btn_run_script = Button(text='Run Script')
btn_run_script.bind(on_press=self._on_run_script)
# add keyframe
btn_add_keyframe = Button(text='Add Keyframe')
btn_add_keyframe.bind(on_press=self._on_add_keyframe)
# root actions menu
robot_actions = Spinner(
text='Action',
values=sorted(self.robot.postures()))
robot_actions.bind(text=self.on_action)
# add to menu
menu.add_widget(mnu_file)
menu.add_widget(btn_add_keyframe)
menu.add_widget(btn_motors_on)
menu.add_widget(btn_motors_off)
menu.add_widget(btn_run_script)
menu.add_widget(robot_actions)
b.add_widget(menu)
m = BoxLayout()
code_status = BoxLayout(orientation='vertical', size_hint=(0.6, 1))
# code input
self.codeinput = CodeInput(
lexer=lexers.PythonLexer(),
font_name='data/fonts/DroidSansMono.ttf', font_size=12,
text="nao.say('hi')")
code_status.add_widget(self.codeinput)
# status window
self.status = TextInput(text="", readonly=True, multiline=True, size_hint=(1.0, 0.25))
code_status.add_widget(self.status)
m.add_widget(code_status)
self.joints_ui = NaoJoints(size_hint=(0.4, 1))
m.add_widget(self.joints_ui)
b.add_widget(m)
return b
开发者ID:VRDate,项目名称:nao-recorder,代码行数:72,代码来源:main.py
注:本文中的pygame.font.get_fonts函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论