本文整理汇总了Python中frame.Frame类的典型用法代码示例。如果您正苦于以下问题:Python Frame类的具体用法?Python Frame怎么用?Python Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__( self, screen, x, y, width, height, vertical, frame1 ):
log.debug( "SplitFrame.__init__" )
Frame.__init__( self, screen, x, y, width, height )
self.split_dragging = False
self.vertical = vertical
if vertical:
self.split = height
else:
self.split = width
self.split = self.split >> 1
self.frame1 = frame1
if vertical:
self.frame1.moveresize( x, y, self.width, self.height - self.split )
# this is a horrible hack to get around circular importing
self.frame2 = self.frame1.topmost_child().__class__( self.screen, self.x, self.y + self.split+4,
self.width, self.height-self.split-4)
else:
self.frame1.moveresize( x, y, self.width - self.split, self.height )
self.frame2 = self.frame1.topmost_child().__class__( self.screen, self.x + self.split+4, self.y,
self.width-self.split-4, self.height)
frame1.tritium_parent.replace_me( frame1, self )
self.frame1.tritium_parent = self.frame2.tritium_parent = self
self.frame1.activate()
self.create_split_window()
示例2: Hooker
class Hooker(object):
def __init__(self, number=None):
self.nFrame = number
self.i = -1
return
def startLoop(self, title="start loop:"):
print title
self.bar = ProgressBar().start()
return
def endLoop(self):
self.bar.finish()
def newFrame(self):
self.frame = Frame()
self.i += 1
return
def postFrame(self):
self.bar.update((self.i+1)*100/self.nFrame)
return
def dataHooker(self, name, sz, arr):
self.frame.loadIntoMemory(name, sz, arr)
return
示例3: nCacheHooker
class nCacheHooker(object):
def __init__(self, number=None):
self.nFrame = number
self.i = -1
def startLoop(self, title="start loop:"):
print title
def endLoop(self):
pass
def resetPass(self):
self.i2 = -1
def newFrame(self):
if self.i < 0:
print "Reading on cache."
self.bar = ProgressBar().start()
self.frame = Frame()
self.i += 1
self.i2 += 1
def postFrame(self):
self.bar.update((self.i2 + 1) * 100 / self.nFrame)
if self.i2 == self.nFrame - 1:
self.bar.finish()
def dataHooker(self, name, sz, arr):
self.frame.loadIntoMemory(name, sz, arr)
示例4: __init__
def __init__(self, screen, game):
''' An example class to show how to creat custom GUI frames'''
Frame.__init__(self, screen, (330, 110), (10, 10))
self.game = game
self.b1 = Button(self, "Toggle Constant", self.command)
self.b2 = Button(self, "Toggle Random", self.command2, position=(5,40))
self.b3 = Button(self, "Toggle Shape", self.command3, position=(5, 75))
self.c_Label = Label(self, "False", position=(135, 10))
self.r_Label = Label(self, "True", position=(135, 45))
self.s_Label = Label(self, "Random", position=(135, 80))
self.l1 = Label(self, "Size", position=(235, 10))
self.tb1 = TextBox(self, (295, 10))
self.l2 = Label(self, "Density", position=(235, 45))
self.tb2 = TextBox(self, (295, 45))
self.l3 = Label(self, "Speed", position=(235, 80))
self.tb3 = TextBox(self, (295, 80))
self.textboxes = {'size' : self.tb1,
'density' : self.tb2,
'speed' : self.tb3}
self.current = 'circle'
示例5: hide
def hide( self ):
Frame.hide( self )
self.tabs.hide()
if self.shown:
for window in self.windows:
window.hide()
self.shown = False
示例6: query
def query(self, mode, pid):
frame = Frame()
frame.id = OBD2_REQUEST
frame.len = 8
frame.flags = 0
frame.data = (2, mode, pid, 0x55, 0x55, 0x55, 0x55, 0x55)
self.can.adapter.write(frame)
示例7: _generatePickledFrames
def _generatePickledFrames(self):
"""
Initialises all the frames
"""
framePath = FRAMENET_PATH+ '/' + FRAME_DIR_ENV + '/' + FRAME_FILE
pickledFramePath = FRAMENET_PATH + '/' + PICKLED_FRAME_FILE
print >> sys.stderr, 'Loading xml for frames ...',
doc = xml.dom.minidom.parse(framePath)
frameNodes = getNoneTextChildNodes(doc.childNodes[1])
print >> sys.stderr, 'done',
frames = {}
print >> sys.stderr, 'parsing each frame ...',
for fn in frameNodes:
f = Frame()
f.loadXMLNode(fn)
frames[f['ID']] = f
print >> sys.stderr, 'done',
print >> sys.stderr, 'saving the frames ...',
cPickle.dump(frames, open(pickledFramePath, 'w'), cPickle.HIGHEST_PROTOCOL)
print >> sys.stderr, 'done'
pass
示例8: show
def show( self ):
Frame.show( self )
self.tabs.show()
if not self.shown:
for window in self.windows:
window.show()
self.shown = True
示例9: TestFPTracking
def TestFPTracking():
i = cv2.imread("../img/s01.jpg")
f = Frame(i, True)
f.detectKeyPoints()
j = cv2.imread("../img/s02.jpg")
g = Frame(j, True)
kp = g.trackKeyPoints(f)
示例10: work
def work(self, input_items, output_items):
inp = input_items[0]
for i in range(len(inp)):
data = []
for x in inp[i]:
data.append(x&0xFF)
data.append(x>>8)
frame = Frame(data, self.frame_prev)
if not frame:
print "no frame" + str(frame)
continue
if not frame.is_broken():
self.frame_prev = frame
self.conf = frame.get(SF_TYPE_CONFIG)
if self.conf is not None:
frame_num = self.conf.frame_num
node_id = self.conf.id
calibration_num = self.conf.calibration_num
de = DataEvent([EVENT_CONFIG, frame_num, node_id, calibration_num])
wx.PostEvent(self.panel, de)
del de
else:
frame_num = 'N/A'
self.meas = frame.get(SF_TYPE_MEASUREMENTS)
if self.meas is not None and self.conf is not None:
temp = self.meas.temp
hum = self.meas.hum_down
pres = self.meas.pressure
de = DataEvent([EVENT_MEASSURE, self.conf.frame_num, temp, hum, pres])
wx.PostEvent(self.panel, de)
del de
#self._dump_frame(frame, frame_num)
#self._dump_eval(frame)
if not self.calibrated and self.conf is not None:
self.calibrated = self.calib.addFragment(self.conf.calibration_num, self.conf.calibration_data)
if self.calibrated:
print("calibration complete at frame %s" % frame_num)
calib_data = self.calib.data()
self.calib = Calibration(calib_data)
de = DataEvent([EVENT_CALIBRATED])
wx.PostEvent(self.panel, de)
del de
print("frame: %s %s" % (frame_num, not frame.is_broken(), ))
return len(inp)
示例11: append
def append( self, window ):
Frame.append( self, window )
tab = Tab( self, window )
window.tab = tab
self.tabs.append( tab )
if not self.visible():
tab.hide()
tab.set_text( window.get_title() )
# shouldn't some of the stuff above be moved into tab_manage?
window.tab_manage()
示例12: TestFeaturesMask
def TestFeaturesMask():
img = cv2.imread("../img/s01.jpg")
ff = Frame(img, True)
#gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
mask = np.zeros(img.shape[:2], np.uint8)
mask[200:500, 0:300] = 1
kp = ff.detectKeyPoints(mask=mask)
ff.showDetectedKeyPoints()
示例13: Dialogue
class Dialogue(object):
def __init__(self, title, message, buttons={}):
frame_title = "dialogue_{0}".format(title)
self.frame = Frame(frame_title, x, y, width, height, z)
self.frame.title = title
self.buttons = buttons
self.frame.closeable = True
background = pygame.surface.Surface((width, height))
background.blit(gradients.vertical((width, height),
colors.OPAQUE_GRAY,
colors.OPAQUE_BLACK), (0, 0))
self.frame.background = background
textbox = self.frame.background.subsurface(pygame.Rect(50, 40,
text_width,
text_height))
button_rect = pygame.Rect(25, 60 + text_height, button_width, 25)
button_area = self.frame.background.subsurface(button_rect)
textrect(message, ui.typography["title"], text_width, colors.WHITE,
surface=textbox)
created_buttons = []
for button_create in buttons:
created_buttons.append(Button(button_create[0], button_create[1]))
total = len(created_buttons)
padding = (button_width - (total * button.width)) / (total + 1)
button_index = 0
for btn in created_buttons:
btn_offset = button_area.get_abs_offset()
btn_rect = pygame.Rect((padding * (button_index + 1)) +
(button.width * button_index), 0,
button.width, button.height)
button_area.blit(btn.image, (btn_rect.x, btn_rect.y))
btn_rect.x += btn_offset[0] + x
btn_rect.y += btn_offset[1] + y
game.addClickableFrame(btn_rect, self.frame, btn.action, 2)
button_index += 1
@property
def title():
return self.frame.title
@title.setter
def title(self, value):
self.frame.title = value
@property
def display(self):
return self.frame.display
@display.setter
def property(self, value):
self.frame.display = value
def toggle(self):
self.frame.toggle()
示例14: draw
def draw( self, surface, interpol, time_sec ):
surface.fill( (50,50,50) )
#resman.get("game.hud_left_surf").draw( surface, Vec2D(0,0) )
frame = Frame( surface, time_sec, interpol )
frame.X_OFFSET = MonorailEditor.X_OFFSET
frame.Y_OFFSET = MonorailEditor.Y_OFFSET
frame.draw_z( [self.level] )
if self.current_tile in [MonorailEditor.FLAT, MonorailEditor.ENTERANCE]:
frame.draw( self.edit_tile1 )
elif self.current_tile in [MonorailEditor.NORTH_SLOPE ,MonorailEditor.EAST_SLOPE, MonorailEditor.SOUTH_SLOPE, MonorailEditor.WEST_SLOPE]:
frame.draw( self.edit_tile1 )
frame.draw( self.edit_tile2 )
elif self.current_tile == MonorailEditor.ERASE:
pass
# draw filename
font = pygame.font.Font( None, 24 )
render_text = font.render( Level.get_filename( self.level_nr ), 0, (255,255,255) )
surface.blit( render_text, (100,10) )
示例15: __init__
def __init__(self, rect, font, name=None):
Frame.__init__(self, rect)
self.active = True
self.font = font
self.textcolor = BUTTONTEXTCOLOR
self.backgroundcolor = BUTTONBACKGROUNDCOLOR
self.name = name
self.textframe = None
# Margins
self.top = 1