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


Python background.Background类代码示例

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


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

示例1: OnMessageStatus

def OnMessageStatus(Message, Status):
    B = Background()
    Marker = ' ';
    if Message.IsEditable:
        Marker = '* ';
    if (Status == 'RECEIVED' or Status == 'SENT'):
        mP = rePlay.match(Message.Body)
        mV = reViel.match(Message.Body)
        if (mP):
            Message.Chat.SendMessage('Aber ich hab keine Lust '+mP.group(1)+' zu spielen.')
        elif (mV and Message.IsEditable):
            def repViel(m):
                print "repViel"
                x = re.sub("viel viel", "viel viel viel", m.Body)
                print "attempted viel viel replacement: " + x
                m.Body = x
            print "found viel viel"
            for i in range(7):
                print i
                B.runLater(2*i, lambda m: repViel(m), {'m':Message})
        elif (Message.Body == 'xyzzy'):
                B.runLater(2, lambda m: m.Chat.SendMessage(m.Body+"?"), {'m':Message})
        elif (Message.Body == '===='):
            Message.Chat.SendMessage('. \n\n\n\n----------------------------\n\n\n\n\n ... sooo weit bin ich noch nicht.')
    if Status == 'RECEIVED':
        print(Message.FromDisplayName + ': ' + Message.Body);
    elif Status == 'SENT':
        print('Myself:' + Marker + Message.Body);
    else:
        print(Message.FromDisplayName + '(' + Message.FromHandle + ')' + Status + ':' + Marker + Message.Body);
开发者ID:phueper,项目名称:SkypeMessagePong,代码行数:30,代码来源:chat.py

示例2: Rules

class Rules(object):
    """menu of the game"""
    def __init__(self, width, height):
        self.initAttr(width, height);

    def loadResource(self):
        self.headMark = pygame.image.load(getFilePath("separators.png"))

    def initAttr(self, width, height):
        self.width, self.height = width, height
        self.loadResource()
        self.background = Background((width, height))
        # 规则文字开始的位置
        offLine = 100
        offSet = 50
        self.content = []
        for content in RULES_CONTENT[0 : -1]:
            offLine += offSet
            self.content.append(Label(RULES_CONTENT_FONTS, content, (50, offLine), headMark = self.headMark))
        self.returnButton = TextButton(RULES_EXIT_FONTS, RULES_CONTENT[-1], (offSet, self.height - offSet), (255, 255, 255))

    def draw(self, screen):
        self.background.draw(screen)
        [content.draw(screen) for content in self.content]
        self.returnButton.draw(screen)
        pygame.display.flip()

    def clickListener(self):
        if (pygame.mouse.get_pressed()[0]):
            mousePos = pygame.mouse.get_pos()
            if self.returnButton.rect.collidepoint(mousePos):
                return STATE.menu
        return STATE.rules
开发者ID:piratf,项目名称:Game_Boxes,代码行数:33,代码来源:rules.py

示例3: _background

	def _background(self):
		if self.__background is None:
			self.__background = pygame.Surface(self._screen().get_size())
			self.__background = self.__background.convert()
			bg = Background(self.__background)
			bg.fill()
		return self.__background
开发者ID:chamblin,项目名称:coin_runner,代码行数:7,代码来源:game.py

示例4: __init__

    def __init__(self, dt=0.1, auto_dt=False):
        """
        Class constructor
        """

        self.background = Background()
        # check width and height
        ret, cap = self.background.capture.read()
        height, width, channels = np.array(cap).shape

        self.render = vtk.vtkRenderer()
        self.render.SetLayer(2)

        # self.camera = vtk.vtkCamera()
        # self.camera.SetPosition(-10, 0, 0)
        # self.camera.SetFocalPoint(0, 0, 0)
        # self.render.SetActiveCamera(self.camera)
        # self.render.ResetCamera()

        self.render_window = vtk.vtkRenderWindow()
        self.render_window.SetNumberOfLayers(3)
        self.render_window.SetSize(width, height)
        self.render_window.AddRenderer(self.background.render)
        self.render_window.AddRenderer(self.render)

        self.t = 0
        self.dt = dt
        self.auto_dt = auto_dt

        self.actors = []
开发者ID:asrob-uc3m,项目名称:augmented-fpv,代码行数:30,代码来源:director.py

示例5: open

 def open(self):
     init_analysis(self.main_window)
     self.main_window.analysis_next_btn.setEnabled(True)
     if self.source.media == 'file':
         self.source.base_name = get_base_file(self.file) 
         self.source.analysis_frames = cv2.VideoCapture(self.file)
     if self.source.media == 'camera':
         init_analysis_camera(self.main_window)
         print("Setting analysis frames for camera")
         # release camera resource for analysis
         self.source.setup_frames.release()
         self.source.analysis_frames = cv2.VideoCapture(config['camera'])
     # images folder
     directory = 'images/' + self.source.base_name
     create_dir(directory) 
     self.get_video()
     if self.source.media == 'file':
         self.setup.load_video(self.video.id)
     self.background = Background(self.source) 
     self.background.get_db(self.video.id)
     self.source.background = self.background
     self.polygon = Polygon(self.source, self.setup) 
     self.polygon.get_points(self.video.id)
     self.polygon.draw_setup(self.background.frame, self.polygon.points)
     self.source.polygon = self.polygon
     self.play = Play(self.source, self.setup)
     self.play.run_analysis()
     # set location
     self.location.set_location(self.video.address_id)
     # play
     self.click_analysis_play_btn()
开发者ID:janmaghuyop,项目名称:fuzztrack,代码行数:31,代码来源:analysis.py

示例6: initElement

 def initElement(self):
     # 背景
     self.background = Background((self.width, self.height))
     backgroundColor = GAME["GAME_BACKGROUND_COLOR"]
     self.background.setColor(backgroundColor)
     # 返回按钮
     self.returnButton = TextButton(GAME["RETURN_BUTTON_FONTS"], GAME["RETURN_BUTTON_CONTENT"], (30, 30))
开发者ID:piratf,项目名称:Game_Boxes,代码行数:7,代码来源:game.py

示例7: backgroundChanged

 def backgroundChanged(self, dummyDeferredResult, dummyOldName, newName):
     """if the wanted background changed, apply the change now"""
     centralWidget = self.centralWidget()
     if centralWidget:
         self.background = Background(newName)
         self.background.setPalette(centralWidget)
         centralWidget.setAutoFillBackground(True)
开发者ID:KDE,项目名称:kajongg,代码行数:7,代码来源:mainwindow.py

示例8: __init__

 def __init__(self):
     self.background = Background()
     self.shot = Fire()
     self.senary = Senary()
     self.trilha = pygame.mixer.Sound(os.path.join("sound","trilha.wav"))
     self.tiro = pygame.mixer.Sound(os.path.join("sound",'tiro.wav'))
     self.porrada = pygame.mixer.Sound(os.path.join("sound",'porrada.wav'))
     self.morreu = pygame.mixer.Sound(os.path.join("sound",'morreu.wav'))
     self.trilha.play(-1)
     self.img = pygame.Surface((80,120))
     self.img = pygame.image.load(os.path.join("img",'joao1.png'))
     self.imgS = pygame.image.load(os.path.join("img",'joao2.png'))
     self.imgC = pygame.image.load(os.path.join("img",'joao1c.png'))
     self.imgSC = pygame.image.load(os.path.join("img",'joao2c.png'))
     self.img.set_colorkey((10,255,0),0)
     self.img.set_alpha(255,0)
     self.img2 = pygame.Surface((80,120))
     self.img2.set_colorkey((10,255,0),0)
     self.img2.set_alpha(255,0)
     self.pos = pygame.Rect((120,320,80,120))
     self.jump = 0
     self.jump_h = 11
     self.life = 5
     self.face = 1
     self.x = 0
     self.contx = 0
     self.step = 1
     self.score = 0
     self.moveActivedJump = 1 
     draw(self.img,(self.pos.left,self.pos.top))
     self.background.sky()
     self.drawLife()
开发者ID:pugpe,项目名称:auto_da_compadecida,代码行数:32,代码来源:avata.py

示例9: __init__

	def __init__(self, *args, **kwargs):
		super(GameWindow, self).__init__(*args, **kwargs)
		
		self.mainBatch = pyglet.graphics.Batch() #"Misc" drawables
		self.hudBatch = pyglet.graphics.Batch() #Drawn after everything

		self.background = Background()
		self.playerShip = physicalobject.Player(x=0, y=0)
				
		
		self.push_handlers(self.playerShip.keyHandler)

		self.paused = False
		self.camera = Vector(0,0)

		#Basically targetting either 1920x1080 (and 1920x1200) at 1, or 1366x768 ish at 0.5
		self.uiScale = 1
		if self.width < 1400 or self.height < 800: self.uiScale = 0.5
		
		self.hud = hud.HUD(window=self, batch=self.hudBatch)
		
		self.currentSystem = solarsystem.SolarSystem(x=0, y=0, seed=0)
		self.currentSystem.ships.append(self.playerShip)
		components.init()
	
		pyglet.clock.schedule_interval(self.update, 1/60.0)
开发者ID:Nebual,项目名称:spad,代码行数:26,代码来源:game.py

示例10: __init__

    def __init__(self, parent, rows=1, cols=7):
        super(Gtk.DrawingArea, self).__init__()

        self.par = parent
        self.num_rows = rows
        self.num_columns = cols
        self.background = Background(rows, cols)

        self.padding = 1.5
        self.font = "Courier"
        self.font_size = 12
        self.font_color = (0.35, 0.31, 0.24)
        self.link_color = (0, 0, 255, 0.5)  # default blue link color
        self.today_cell = (None, None)
        self.selected_task = None
        self.faded_cells = []
        self.cells = []
        self.labels = None
        self.label_height = self.font_size
        self.overflow_links = []

        self.connect("draw", self.draw)

        # drag-and-drop signals and events
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.BUTTON1_MOTION_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK)
开发者ID:sararibeiro,项目名称:calendar-plugin,代码行数:28,代码来源:all_day_tasks.py

示例11: promptUserForPin

    def promptUserForPin():
        userHasAccess = True

        # Set the background
        background = Background.createBackground()
        if background is not None:
            background.show()

        # Prompt the user to enter the pin
        numberpad = NumberPad.createNumberPad()
        numberpad.doModal()

        # Remove the background if we had one
        if background is not None:
            background.close()
            del background

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        # Check to see if the pin entered is correct
        if Settings.isPinCorrect(enteredPin):
            log("PinSentry: Pin entered Correctly")
            userHasAccess = True
            # Check if we are allowed to cache the pin level
            PinSentry.setCachedPinLevel(1)
        else:
            log("PinSentry: Incorrect Pin Value Entered")
            userHasAccess = False

        return userHasAccess
开发者ID:ryanjrose,项目名称:sualfreds-repo,代码行数:32,代码来源:service.py

示例12: entities

 def entities(self):
     self.label = pyglet.text.Label('Hello, world',
                                    font_name = 'Times New Roman',
                                    font_size = 36,
                                    x = self.width/2, y = self.height/2,
                                    anchor_x = 'center', anchor_y = 'center')
     self.panel = Panel((self.width,self.height))
     self.background = Background((self.width,self.height),self.panel.size)
     self.background.pos = [self.mapsize[0] / 2, self.mapsize[1] / 2]
     self.background.populate()
     self.bgcheck = 1
     self.player = player.Player((self.width,self.height),self.panel.size)
     self.player.name = self.name
     self.player.idnum = self.idnum
     self.player.location[0] = self.startsystem
     self.spritelist = [self.player.sprite]
     self.visible_size = (self.background.x,self.background.y)
     self.systemdict = MakeSystemDict("data/systems/systems.list",self.player.pos,self.center,self.visible_size)
     self.systemdict.get(self.startsystem.name).update(self.startsystem)
     self.systemdict.get(self.startsystem.name).active = 1
     self.system = self.systemdict.get(self.startsystem.name)
     self.selectedsystem = None
     self.activesystem = self.system.name
     self.linkdict = MakeLinks(self.systemdict)
     print "LINKDICT: " + str(self.linkdict)
     self.menudialogue = MenuDialogue((self.width,self.height))
     self.optionsdialogue = OptionsDialogue((self.width,self.height))
     self.controlsdialogue = ControlsDialogue((self.width,self.height))
     self.dockdialogue = DockDialogue((self.width,self.height))           
     self.mapdialogue = MapDialogue((self.width, self.height))
     self.mapdialogue.active = self.activesystem
开发者ID:remremrem,项目名称:EV-Tribute,代码行数:31,代码来源:game.py

示例13: __init__

    def __init__(self, file_name):
        pygame.init()
        self.display_surf = pygame.display.set_mode((WINDOW_SIZE_X, WINDOW_SIZE_Y), 0, 32)
        pygame.display.set_caption("Dinosaurs Evolved")

        self.change = False  # Used to see if the board needs to be redrawn
        self.down_keys = Set()  # The keys that the user is currently holding down
        self.player = Player()
        self.background = Background(file_name)
        self.loop()
开发者ID:lightningmonkey,项目名称:dino,代码行数:10,代码来源:main.py

示例14: TheApp

class TheApp(cocos.layer.Layer):
    # If you want that your layer receives events
    # you must set this variable to 'True',
    # otherwise it won't receive any event.
    is_event_handler = True

    def __init__(self):
        super(TheApp, self).__init__()

        self.image = pyglet.resource.image('terrain_4.png')
        self._background = Background()
        self._objects = []
        enemy = Enemy()
        self._objects.append(enemy)
        self._player = Player()
        self._objects.append(self._player)
        # call the "step" method every frame when the layer is active
        self.schedule(self.step)

    def on_enter(self):
        super(TheApp, self).on_enter()
        self._background.init()
        for ob in self._objects:
            ob.init()

    def draw(self):
        super(TheApp, self).draw()
        self._background.draw()
        for ob in self._objects:
            ob.draw()

    def step(self, dt):
        for ob in self._objects:
            ob.update(dt)

    def on_key_press(self, symbol, modifiers):
        if symbol == key.RIGHT:
            self._player.setXVelocity(10)
        if symbol == key.LEFT:
            self._player.setXVelocity(-10)

    def on_key_release(self, key, modifiers):
        self._player.setXVelocity(0)
开发者ID:CoderDojoZH,项目名称:workshops,代码行数:43,代码来源:the_app.py

示例15: __init__

    def __init__(self, cols=7):
        super(Header, self).__init__()
        self.labels = []
        self.background = Background(1, cols)
        self.sidebar = 0
        self.font = "Courier"
        self.font_size = 12
        self.font_color = (0.35, 0.31, 0.24)
        self.highlight_cell = (None, None)

        self.connect("draw", self.draw)
开发者ID:sararibeiro,项目名称:calendar-plugin,代码行数:11,代码来源:header.py


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