本文整理汇总了Python中pygame.display.set_caption函数的典型用法代码示例。如果您正苦于以下问题:Python set_caption函数的具体用法?Python set_caption怎么用?Python set_caption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_caption函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: limit_fps
def limit_fps(self, set_caption=True):
t_delta = self._clock.tick(self._fps)
t_raw = self._clock.get_rawtime()
real_fps = int(self._clock.get_fps())
# too much less than 15 FPS and the brain stops pretending it's motion
if real_fps < self._fps - 3 and self._fps > 15:
self._lag += 1
if self._lag > 100:
self._fps /= 2
self._lag = 0
else:
if self._lag >= 0:
self._lag -= 1
# no sense in going over 60 FPS (that i'm aware, anyway)
elif t_raw * 2 < t_delta and self._fps < 60:
self._lag -= 1
else:
self._lag += 1
if self._lag < -100:
self._fps *= 2
self._lag = 0
if set_caption:
display.set_caption('{} fps, targeting {} (lag: {})'.format(
real_fps, self._fps, (self._lag + 5) // 10
))
self._t_delta = t_delta
return t_delta
开发者ID:zengaku12,项目名称:padpyght,代码行数:28,代码来源:frame_buffer.py
示例2: main
def main():
pygame.init()
display.set_mode((1280, 720), pygame.RESIZABLE)
display.set_caption("Ethos")
display.set_gamma_ramp
game = EthosMain()
game.run()
开发者ID:Berulacks,项目名称:ethosgame,代码行数:7,代码来源:game.py
示例3: open_url
def open_url(screen, img):
gl.ISURL = 1
num_imgs = len(gl.files)
paint_screen(screen, gl.BLACK)
set_caption("Extract from Web - imgv")
normal_cursor()
show_message(screen, "Enter a Web URL to extract images from", 20, 15, ("transparent"))
gl.URL = ask(screen, "http://")
if gl.URL != None:
gl.files = []
wait_cursor()
show_message(screen, "Loading. Please wait..", 39, 42, ("transparent"))
for ext in gl.IMG_TYPES:
if gl.URL.endswith(ext):
gl.files.append(str("".join(gl.URL)))
return (load_img(gl.files[0], screen), 1)
else:
return (img, num_imgs)
gl.files = []
check_indexhtml()
if gl.URL_ERROR:
gl.files.append(gl.ERROR_IMG)
return (load_img(gl.ERROR_IMG, screen), len(gl.files))
if len(gl.files) < 1:
gl.files.append(gl.ERROR_IMG)
gl.files = [x.replace(" ", "%20") for x in gl.files] # urls need %20 for spaces
return (load_img(gl.files[0], screen), len(gl.files))
开发者ID:paulmadore,项目名称:luckyde,代码行数:27,代码来源:open_url.py
示例4: __init__
def __init__(self, resolution, world, viewport=None):
pgdisplay.init()
self.screen = pgdisplay.set_mode(resolution, pg.DOUBLEBUF)
# self.screen = pgdisplay.set_mode(resolution, pg.DOUBLEBUF|pg.FULLSCREEN)
pgdisplay.set_caption('PyAudioEffect')
self.world = world
self.viewport = viewport
开发者ID:ZhanruiLiang,项目名称:AudioEffect,代码行数:7,代码来源:display.py
示例5: start_menu
def start_menu():
from pygame.display import set_mode, list_modes, set_caption
from pygame import init, quit
from pygame.constants import FULLSCREEN
from bin.Controller import process
from obj.Field import Field
init()
screen = set_mode(list_modes()[0], FULLSCREEN)
set_caption("Hero Misadventures")
menu = Menu(("Previous Field", "New Field", "Load Field", "Quit"), screen, surface=color("Lawn Green"),
selection_color=color("Lime Green"), text_color=color("Medium Blue"))
while True:
choose = menu.update()
if choose == 0:
field = Field(screen)
process(screen, field)
elif choose == 1:
from ctypes import cdll
cdll.LoadLibrary("Generator.so").main_generator("res/GENERATOR.HMinf", "res/FIELD.HMmap")
field = Field(screen)
process(screen, field)
elif choose == 2:
from pickle import load
field = load(open("res/SAVE.HMsave", "rb"))
field.screen = screen
process(screen, field)
elif choose == 3:
quit()
return
开发者ID:creators1303,项目名称:Hex_Platform,代码行数:31,代码来源:Interaction.py
示例6: hover_fx
def hover_fx(screen, curdir, x, cursor):
slash = os.sep
dash = ' - '
flag = 0
for it in x:
if it[0].collidepoint(cursor):
flag = 1
(shortcut, dirname) = it[1].split(gl.DIRNUMSEP)
if dirname == slash:
fullpath = curdir.split(slash)[0] + slash
elif dirname == '..':
fullpath = slash.join(curdir.rstrip(slash).split(slash)[:-1]) + slash
if fullpath.split(dash)[0] == slash:
# make it so when in root dir of MS-Windows it prints drive letter
fullpath = curdir.split(slash)[0] + slash
else:
fullpath = curdir + dirname + slash
gl.OLD_CAP = fullpath + ' [' + shortcut + '] - imgv'
if gl.OLD_CAP != get_caption()[0]:
# perform only once (otherwise it flashes in title bar)
set_caption(gl.OLD_CAP)
break
if not flag:
gl.OLD_CAP = curdir + " - imgv"
# nothing was hovered on the last pass
if gl.OLD_CAP != get_caption()[0]:
set_caption(gl.OLD_CAP)
开发者ID:paulmadore,项目名称:luckyde,代码行数:27,代码来源:dir_nav.py
示例7: command_thumbs
def command_thumbs(screen, new_img, file):
normal_cursor()
gl.THUMBING = 1
screen_width = screen.get_width()
if gl.THUMB_VAL.upper() == "AUTO" or gl.USING_THUMB_DEFAULT:
gl.USING_THUMB_DEFAULT = 1
if screen_width == 640:
gl.THUMB_VAL = "85x90"
elif screen_width == 800:
gl.THUMB_VAL = "108x114"
elif screen_width == 1024:
gl.THUMB_VAL = "108x104"
else:
gl.THUMB_VAL = "100x100"
if not gl.TOGGLE_FULLSCREEN_SET:
screen = set_mode(screen.get_size()) # take away resize priviledges
paint_screen(gl.IMGV_COLOR)
set_caption("imgv")
(new_img, new_img, new_img, file) = thumbs_engine(screen, new_img, file)
if not gl.TOGGLE_FULLSCREEN_SET:
screen = set_mode(screen.get_size(), RESIZABLE) # restore resize priviledges
rect = get_center(screen, new_img)
my_update_screen(new_img, rect, file)
normal_cursor()
gl.THUMBING = 0
return (new_img, new_img, new_img, file, rect)
开发者ID:rkulla,项目名称:imgv,代码行数:28,代码来源:thumb.py
示例8: my_slideshow
def my_slideshow(new_img, img, screen, file, num_imgs, rect):
if not gl.TOGGLE_FULLSCREEN_SET:
screen = set_mode(screen.get_size())
set_caption("Slideshow Options - imgv")
speed = get_speed(screen, new_img, rect, gl.files[file], file, num_imgs)
if not speed == -1: # didn't hit Esc from get_speed:
gl.SLIDE_SHOW_RUNNING = 1
disable_screensaver()
dont_call = 0
pygame.event.set_blocked(MOUSEMOTION)
while 1:
event = pygame.event.poll()
pygame.time.wait(1)
check_quit(event)
if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL, K_p, K_PAUSE, K_TAB, K_SPACE, K_BACKSPACE):
stopped_msg(screen)
my_update_screen(new_img, screen, rect, file, len(gl.files))
file = file - 1
break
if hit_key(event, K_p) or hit_key(event, K_PAUSE):
pause(screen)
my_update_screen(new_img, screen, rect, file, len(gl.files))
if dont_call == 1:
break
if not gl.WRAP_SLIDESHOW:
if file < num_imgs:
(new_img, file, rect, dont_call) = show_slideshow_img(screen, new_img, file, num_imgs, speed)
if gl.WRAP_SLIDESHOW:
if file >= num_imgs:
file = 0
(new_img, file, rect, dont_call) = show_slideshow_img(screen, new_img, file, num_imgs, speed)
pygame.time.delay(5) # don't hog CPU
if not gl.TOGGLE_FULLSCREEN_SET:
screen = set_mode(screen.get_size(), RESIZABLE)
return (new_img, new_img, new_img, file, rect)
开发者ID:paulmadore,项目名称:luckyde,代码行数:35,代码来源:slideshow.py
示例9: __init__
def __init__(self):
init()
self.n = 3
self.planets = {i:PLANET() for i in range(self.n)}
self.cm_velocity_zero()
display.set_caption('Planets')
self.clock = time.Clock()
开发者ID:nandakishoremmn,项目名称:Planets_pygame,代码行数:7,代码来源:main.py
示例10: flow_projects_select
def flow_projects_select(self,btn):
#make the selected project the active one
try:
idu = btn.Id if isinstance(btn, ArtifactController)\
else btn._id #IGNORE:W0212
self.current_project = self.artifacts[idu]
self.viewCurrentProject(btn)
except KeyError:
#create new project
lbl = self.new_project_pressed()
if lbl is None: return
self.current_project = self.artifacts[lbl.Id]
set_caption(self.current_project[0].Name)
#we need to populate the releases flow with any release
#in the current project
self.load_releases()
self.container_reset_children('release_flow')
self.container_reset_children('sprint_flow')
self.container_reset_children('story_flow')
self.container_reset_children('task_flow')
if self.current_project and self.current_project[0].Children:
for release in self.current_project[0].Children:
if release in self.artifacts:
r = self.artifacts[release][0]
if r.ArtifactType != 'Release': continue
self.newRelease(r)
else:
Log.debug('Project: %s found a release: %s not in releases' % \
(self.current_project[0].Name,release))
开发者ID:estemenson,项目名称:CMAP,代码行数:29,代码来源:storyapp.py
示例11: admin_menu
def admin_menu():
from pygame.display import set_mode, list_modes, set_caption
from pygame import init, quit
init()
screen = set_mode(list_modes()[0])
set_caption("Hero Misadventures")
menu = Menu(("Debug", "Release"), screen, text_color=color("White"), surface=color("Black"),
selection_color=color("Slate Gray"))
while True:
choose = menu.update()
if choose == -1:
continue
else:
if choose == 0:
from cProfile import runctx
from pstats import Stats
runctx("from bin.Interaction import debug_menu; debug_menu(screen)", {"screen": screen}, {}, "test/profiling.prof")
file = open("test/profiling.txt", "w")
info = Stats("test/profiling.prof", stream=file)
info.strip_dirs().sort_stats("cumulative").print_stats()
elif choose == 1:
quit()
start_menu()
return
开发者ID:creators1303,项目名称:Hex_Platform,代码行数:26,代码来源:Interaction.py
示例12: __initPython
def __initPython(self, windowSize):
self.__windowSize = windowSize
self.__window = display.set_mode(self.__windowSize)
display.set_caption("Atlas Chronicle Game Engine")
self.__screen = display.get_surface()
self.__canvas = Surface(self.__windowSize)
开发者ID:elizabeth-matthews,项目名称:atlasChronicle,代码行数:8,代码来源:gameEngine.py
示例13: set_mode
def set_mode(self):
#modes = display.list_modes()
#self.display_surface = display.set_mode(modes[0], self.get_flags())
self.display_surface = display.set_mode((800,600), self.get_flags())
self.width = self.display_surface.get_width()
self.height = self.display_surface.get_height()
display.set_caption("Woger the Wibbly Wobbly Wombat")
开发者ID:mjs,项目名称:ldnpydojo,代码行数:8,代码来源:window.py
示例14: command_hide
def command_hide(screen, new_img, rect, file, num_imgs):
"hide the image by making the screen blank"
(screen, before_winsize, not_accepted) = adjust_screen(screen, NOFRAME)
set_caption("")
hide(screen)
screen = restore_screen(screen, before_winsize, not_accepted, new_img, file, num_imgs, rect)
rect = get_center(screen, new_img)
my_update_screen(new_img, screen, rect, file, num_imgs)
开发者ID:paulmadore,项目名称:luckyde,代码行数:8,代码来源:hide.py
示例15: __initPython
def __initPython(self, windowSize):
self.__windowSize = windowSize
self.__window = display.set_mode(self.__windowSize)
display.set_caption("Fractal Engine")
self.__screen = display.get_surface()
self.__canvas = Surface(self.__windowSize)
self.__canvas.fill((100,100,100))
开发者ID:elizabeth-matthews,项目名称:atlasChronicle,代码行数:9,代码来源:fractalHandler.py
示例16: show_fps
def show_fps():
'''
Displays the game's framerate on the window caption. Meant to be called
in Debug mode with assert statements so that this is effortlessly stripped
out in Release mode.
@invariant: MUST return an object that evaluates to False.
'''
set_caption("FPS: %3g" % round(fps_timer.get_fps(), 3))
开发者ID:CorundumGames,项目名称:Invasodado,代码行数:9,代码来源:config.py
示例17: __init__
def __init__(self, game):
self.game = game
self.viewport = None
display.init()
font.init()
self.fonter = font.SysFont('monospace', 16)
self.screen = display.set_mode((config.screenW, config.screenH), DOUBLEBUF, 32)
display.set_caption("Smash the tanks!")
开发者ID:ZhanruiLiang,项目名称:GeoTank,代码行数:9,代码来源:render.py
示例18: command_help
def command_help(screen, new_img, file, rect):
(screen, before_winsize, not_accepted) = adjust_screen(screen)
set_caption("Help [imgv v%s]" % gl.IMGV_VERSION)
help(screen)
screen = restore_screen(screen, before_winsize, not_accepted, new_img, file, rect)
rect = get_center(screen, new_img)
my_update_screen(new_img, rect, file)
开发者ID:rkulla,项目名称:imgv,代码行数:10,代码来源:help.py
示例19: pause
def pause(screen):
while 1:
set_caption("[Slideshow Paused] - imgv")
ren_rect = show_message(screen, "Paused", 30, 23, ("bold"))
event = pygame.event.wait()
check_quit(event)
if event.type == KEYDOWN and event.key not in(K_LALT, K_RALT, K_LCTRL, K_RCTRL, K_TAB):
set_caption("Slideshow = imgv")
paint_screen(screen, gl.BLACK, ren_rect)
break
开发者ID:paulmadore,项目名称:luckyde,代码行数:10,代码来源:slideshow.py
示例20: command_four
def command_four(screen, file, new_img):
gl.MULTI_VIEWING = 1
paint_screen(gl.IMGV_COLOR)
set_caption("Four at a time - imgv")
(file, new_img) = four(screen, file, new_img)
rect = get_center(screen, new_img)
my_update_screen(new_img, rect, file)
pygame.event.set_blocked(MOUSEMOTION) # without this the hovers don't work right
gl.MULTI_VIEWING = 0
return (file, new_img, new_img, new_img, rect)
开发者ID:rkulla,项目名称:imgv,代码行数:10,代码来源:four.py
注:本文中的pygame.display.set_caption函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论