当前位置: 首页>>代码示例>>Python>>正文


Python font.init函数代码示例

本文整理汇总了Python中pygame.font.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, pygameWindow,gameVariable,images):

        # bool hodnoty
        self.notOver = True
        self.startGame = False
        self.closeGame = False
        self.loadGame = False

        self.gameVariable = gameVariable

        # okno
        self.window = pygameWindow
        self.images = images

        #velkosti

        self.rectWidth = pygameWindow.get_width() / 3
        self.rectHeight = pygameWindow.get_height()  / 10

        self.rectX = (pygameWindow.get_width() / 2) - (self.rectWidth / 2)


        # Rect(top,left, width, height)
        self.nazovHryRect = Rect(0,0,self.window.get_width(),pygameWindow.get_height()/3)
        self.newGameRect = Rect(self.rectX, 150, self.rectWidth, self.rectHeight)
        self.loadGameRect = Rect(self.rectX, 250, self.rectWidth, self.rectHeight)
        self.exitRect = Rect(self.rectX, 350, self.rectWidth, self.rectHeight)

        # font a texty
        font.init()
        self.font = font.SysFont("norasi",int(self.rectHeight/2))

        #iniclializacia lablov
        self._initLabel()
开发者ID:salian2,项目名称:Semestralka-UNIX,代码行数:34,代码来源:Menu.py

示例2: __init__

    def __init__(self, size, tilesize=100, message_font=None, glyph_font=None, margin=50, circle=False, tile_cls=None):
        Board.__init__(self, size, tile_cls)

        font.init()
        message_font      = message_font or (None, 60)
        glyph_font        = glyph_font or (None, 70)
        self.message_font = font.Font(message_font[0], message_font[1])
        self.glyph_font   = font.Font(glyph_font[0], glyph_font[1])
        n                 = tilesize + 1
        self.margin       = margin
        self.scr          = display.set_mode((size[0]*n + margin*2, size[1]*n + margin*2))
        self.scr.fill(white)
        self.sfc = Surface(self.scr.get_size())
        self.sfc = self.sfc.convert()
        self.sfc.fill(white)

        self.scr.blit(self.sfc, (0,0))
        self.tilesize  = tilesize
        self.circle    = circle
        self.tile_locs = [[ (iround(margin+x+tilesize/2) , iround(margin+y+tilesize/2))
                              for x in range(0, size[0]*n, n)]
                              for y in range(0, size[1]*n, n)]
        for tile in self:
            self.mkgui_tile(tile.loc)

        self.scr.blit(self.sfc, (0,0))
        display.flip()
开发者ID:akulakov,项目名称:pygame-games,代码行数:27,代码来源:board.py

示例3: __init__

    def __init__(self, display_w, display_h):
        pygame.init()
        mixer.init()
        font.init()

        # check if the mixer was successfully initialized
        if mixer.get_init() is None:
            print("Failed to initialize the audio mixer module.")

        if font.get_init() is None:
            print("Failed to initialize the font module.")

        self.fps = 120
        self.world = None
        self.gui = Gui(self)

        # Create screen display with 32 bits per pixel, no flags set
        self.display = pygame.display.set_mode((display_w, display_h), pygame.HWSURFACE, 32)
        self.delta_time = 0.0
        self.debug = False
        self.paused = False

        self.print_fps = False

        self.worlds = list()

        self.game = None
开发者ID:Unit978,项目名称:luminescence_standalone,代码行数:27,代码来源:engine.py

示例4: test_font_file_not_found

    def test_font_file_not_found(self):
        # A per BUG reported by Bo Jangeborg on pygame-user mailing list,
        # http://www.mail-archive.com/[email protected]/msg11675.html

        pygame_font.init()
        self.failUnlessRaises(IOError,
                              pygame_font.Font,
                              'some-fictional-font.ttf', 20)
开发者ID:AjithPanneerselvam,项目名称:Gamepy,代码行数:8,代码来源:font_test.py

示例5: __init__

 def __init__(self, text, location, color=(0, 0, 0)):
     if not font.get_init():
         font.init()
     self.fnt = font.Font(ui_enums.DEFAULT_FONT, ui_enums.DEFAULT_FONT_SIZE)
     self.srf = self.fnt.render(text, 1, color)
     self.color = color
     self.location = location
     self.update()
开发者ID:ROBOMonkeys,项目名称:tower-defense-game,代码行数:8,代码来源:interfaces.py

示例6: __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

示例7: defaultbox

def defaultbox(screen, orect, text):

    irect = (tuple(i + BORDERW for i in orect[0]),
             tuple(b - 2 * BORDERW for b in orect[1]))
    fontupleft = tuple(i + 2 for i in irect[0])
    font.init()
    fontobj = font.Font(FONTFILE, FONTSIZE)
    textbox(screen, orect, irect, fontupleft, fontobj, text,
            borderc=BORDERC, boxc=BOXC, textc=TEXTC)
开发者ID:brentnewey,项目名称:Sokoban,代码行数:9,代码来源:inputbox.py

示例8: Init

def Init():
    global font_path
    global basic_font
    global rendered_text
    global huge_font
    font.init()
    basic_font = font.Font(font_path, 32)
    huge_font = font.Font(font_path, 64)
    rendered_text = None
开发者ID:smitnich,项目名称:Crop-Puzzle-Game,代码行数:9,代码来源:TextHandler.py

示例9: main

def main():
    print "#"*31
    print "### Welcome to MindMixer ###"
    print "####### Version 0.1beta #######"
    print """Have a look at the sourcecode!
Change stuff to suit your needs!
The program will hopefully be
self explaining. Hafe fun!"""
    print "#"*31
    selftests()
    global N
    while 1:
        print "(Hint: while training, you can hit SPACE to abort)"
        print "Hit '"+KEYLEFT+"' if the",str(N)+". previous image is identical to the one shown"
        print "Hit '"+KEYRIGHT+"' if the",str(N)+". previous sound is identical to the one heard"
        while 1:
            print "Ready to train with N=%i?" %(N),
            if ask():
                break
            else:
                print "Do you wish to train with N set to a different value? Choosing 'No' exits the program.",
                if ask():
                    n = int(raw_input("Ok, enter the desired value here: "))
                    while n < 1:
                        print "N must be 1 or higher!"
                        n = int(raw_input("Enter a value higher than 1: "))
                    N = n
                else:
                    print "bye"
                    sys.exit(1)
                
        display.init()
        display.set_mode(RESOLUTION, FULLSCREEN)
        font.init()
        mixer.init(44100)
        event.set_grab(True)
        mouse.set_visible(False)
        trials = gentrials()
        for trial in trials:
            if not trial.runtrial():
                break
        display.quit()
        vis = 0.0
        acu = 0.0
        for trial in trials:
            if trial.result[0]:
                vis+=1
            if trial.result[1]:
                acu+=1
        vp = (vis/(MINTRIALS+N))*100
        ap = (acu/(MINTRIALS+N))*100
        message = "percentage in visual modality:%i\npercentage in acoustic modality:%i\n" %(int(vp),int(ap))
        print message
        if vp >= UPPERTH and ap >= UPPERTH:
            N+=1
        elif (vp < LOWERTH or ap < LOWERTH) and N > 1:
            N-=1
开发者ID:sfavors3,项目名称:MindMixer,代码行数:57,代码来源:mindmixer.py

示例10: __init__

	def __init__(self):
		print '%s here' % self.__name__()
		if android:
			android.init()
			android.map_key(android.KEYCODE_MENU, K_ESCAPE)

		init()
		display.set_mode((X_MAX, Y_MAX))

		font.init()

		self.location = Location(self.location_index)
开发者ID:wannadie,项目名称:ideaman,代码行数:12,代码来源:general.py

示例11: __init__

	def __init__( self, screen, message, position, allowed_keys = [], background = (255, 255, 255), text = (255, 0, 0) ):
		pyfont.init()
		self.screen = screen
		self.message = message
		self.position = position
		if allowed_keys:
			self.allowed_keys = allowed_keys
		self.colours = {
			'screen': background,
			'text': text
		}
		self.font = pyfont.Font( None, 36 )
开发者ID:hjpotter92,项目名称:laser-snake,代码行数:12,代码来源:input.py

示例12: __init__

 def __init__(self,service,folder):
   logging.debug('RoomBerry __init__')
   pg.init()
   pg.display.set_caption(CAPTION)
   pg.display.set_mode(SCREEN_SIZE)
   self.__screen = pg.display.get_surface()
   self.__screenRect = self.__screen.get_rect()
   logging.debug('Roomberry __init__ freetype init')
   pgfont.init()
   logging.debug('Roomberry __init__ freetype sysfont')
   logging.debug('Font size')
   # Wish me luck
   self.__roomFolder=service.calendar(folder)
开发者ID:Harlequeen,项目名称:RoomBerry,代码行数:13,代码来源:RoomBerry.py

示例13: __init__

	def __init__(self,string,window):
		font.init()
		self.text = string
        	self.myfont = font.SysFont("Arial", 20)
        	self.render_font = self.myfont.render(string, 1, C.black)
		w = self.render_font.get_width()
		h = self.render_font.get_height()
		self.winh = window.get_height()
		self.rect = Rect(0,self.winh,w,h)
		
		self.movein = False
		self.moveout = False
		self.hold = False
		self.hold_start = 0
开发者ID:kxtells,项目名称:Maze,代码行数:14,代码来源:cMsg.py

示例14: _textDimensions

    def _textDimensions(self, text, size: "points", fontFamily: str) -> (int, int):
        '''Determines the width of rendered text on a specific device. Don't
        call this directly; use a function to normalize Dip and font such that
        no errors would be raised.'''

        # FUTURE: factor in weight

        print("Calculating...")  # DEBUG
        fonts.init()
        font = fonts.SysFont(fontFamily, size)

        width, height = font.size(text)

        return (width, height)
开发者ID:qguv,项目名称:aguille,代码行数:14,代码来源:android.py

示例15: __init__

    def __init__(self, screen, boxw=BOXW, boxh=BOXH, borderw=BORDERW,
                 boxc=BOXC, borderc=BORDERC, textc=TEXTC, fontfile=FONTFILE,
                 fontsize=FONTSIZE, fontspace=FONTSPACE, transtable=None,
                 cb=None, cbargs=None):
        self.__dict__.update(locals())
        self.inupleft = ((screen.get_width() - boxw) / 2,
                         (screen.get_height() - boxh) / 2)
        self.outupleft = tuple(i - borderw for i in self.inupleft)
        self.fontupleft = tuple(i + boxh / 10 for i in self.inupleft)
        self.irect = (self.inupleft, (boxw, boxh))
        self.orect = (self.outupleft,
                      tuple(b + 2 * borderw for b in (boxw, boxh)))

        font.init()
        self.fontobj = font.Font(fontfile, fontsize)
        pygame.key.set_repeat(250, 50)
开发者ID:brentnewey,项目名称:Sokoban,代码行数:16,代码来源:inputbox.py


注:本文中的pygame.font.init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。