本文整理汇总了Python中console.Console.update方法的典型用法代码示例。如果您正苦于以下问题:Python Console.update方法的具体用法?Python Console.update怎么用?Python Console.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类console.Console
的用法示例。
在下文中一共展示了Console.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Screen
# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import update [as 别名]
class Screen:
"""
Screen class definition : contains radar & edit screen data & methods
Methods:
Screen(tmx) : constructor
echo(msg) : print something at screen
update(sim,traf) : Draw a new frame of screen
ll2xy(lat,lon) : lat/lon[deg] to pixel coordinate conversion
xy2ll(x,y) : pixel to lat/lon[de]g conversion
zoom(factor) : zoom in/out
pan(lat,lon) : pan to lat,lon position
Members: see constructor
Created by : Jacco M. Hoekstra (TU Delft)
Updated by : Jerom Maas
"""
def __init__(self):
pg.init()
# Read Screen configuration file:
print
print "Setting up screen..."
lst = np.genfromtxt("data/graphics/scr_cfg.dat", comments='#', dtype='i4')
self.swfullscreen = int(lst[0]) == 0
self.width = int(lst[1]) # default value to create variable
self.height = int(lst[2]) # default value to create variable
# Dimensions radar window
self.lat1 = 53. # [deg] upper limit display
self.lat0 = 51. # [deg] lowerlimit display
self.lon0 = -1. # [deg] left side of screen
dellat = self.lat1 - self.lat0
avelat = (self.lat0 + self.lat1) * 0.5
dellon = dellat * self.width / (self.height * cos(radians(avelat)))
avelon = (self.lon0 + dellon / 2. + 180.) % 360. - 180.
self.lon1 = (self.lon0 + dellon + 180.) % 360. - 180.
self.ctrlat = avelat
self.ctrlon = avelon
# Parameters for making screenshots
self.session = "new"
self.folder= ""
self.screenshot = False
self.screenshotname = ""
# Isometric display parameter
self.isoalt = 0. # how many meters one pixel is high
# Display ADS-B range flag
self.swAdsbCoverage = False
# Update rate radar:
self.radardt = 0.10 # 10x per sec 0.25 # 4x per second max
self.radt0 = -999. # last time drawn
self.maxnrwp = 1000 # max nr apts+wpts to be drawn
#----------------------------SYMBOLS-----------------------------
# Read graphics for acsymbol (normal = green) + amber
self.acsymbol = []
for i in range(60):
self.acsymbol.append(pg.image.load("data/graphics/acsymbol/acsymbol" \
+ str(i) + ".png"))
self.ambacsymbol = []
for i in range(60):
self.ambacsymbol.append(pg.image.load("data/graphics/amb-acsymbol/amb-acsymbol" \
+ str(i) + ".png"))
# Lable lines& default no trails
self.swlabel = 3
# Read and scale waypoint symbol
wptgif = pg.image.load("data/graphics/waypoint.gif")
self.wptsymbol = pg.transform.scale(wptgif, (10, 7))
self.wpsw = 1 # 0=None, 1 = VOR 2 = non-digit ones, 3 =all
# Read and scale airport symbol
aptgif = pg.image.load("data/graphics/airport.gif")
self.aptsymbol = pg.transform.scale(aptgif, (12, 9))
self.apsw = 1 # 0 = None, 1 = Large, 2 = All
# Free flight displays
self.swsep = False # To show circles of 2.5 nm radius around each aircraft
# Note: circles will be distorted when away from equator
self.swspd = False # To show speed vectors of each aircraft
self.swtestarea= False
#.........这里部分代码省略.........
示例2: Console
# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import update [as 别名]
import pygame
from console import Console
from computer import Computer
from level import Screen
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((1024,768))
spaceConsole = Console()
spaceComputer = Computer()
oxigen = 25
testStates = [["close",1],["open",0]]
testTransitions = {"open":("close","capsule","open")}
testObjects = {oxigen, "capsule"}
testScreen = Screen(testObjects,testStates,testTransitions)
while 1:
line = spaceConsole.update()
if line is not None:
line = line.lower()
spaceComputer.processString(line,testScreen)
print testScreen.getState()
pygame.display.flip()