本文整理汇总了Python中kivy.garden.graph.Graph.pos_hint方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.pos_hint方法的具体用法?Python Graph.pos_hint怎么用?Python Graph.pos_hint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.garden.graph.Graph
的用法示例。
在下文中一共展示了Graph.pos_hint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import pos_hint [as 别名]
def __init__(self, **kwargs):
super(FourthScreen, self).__init__(**kwargs)
# create buttons
btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'x':0.45})#,'y':0})
btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})
self.add_widget(btnRight)
self.add_widget(btnLeft)
# create graph
graph = Graph()
plot = LinePlot(mode='line_strip',color=[1,0,0,1])
plot.points = [(x[i],y[i]) for i in xrange(len(x))]
graph.add_plot(plot)
graph.x_ticks_major=.5
graph.xmin=xmin
graph.xmax=xmax
graph.ymin=ymin
graph.ymax=ymax
graph.y_ticks_major=10
graph.xlabel='Time (min)'
graph.ylabel='Brain Wave Amplitude (mV)'
graph.y_grid = True
graph.x_grid = True
graph.size_hint=(0.4,0.9)
graph.x_grid_label=True
graph.y_grid_label=True
# create video player
video = VideoPlayer(source='Momona.mp4')
video.play=False
video.size_hint=(0.5,0.9)
video.pos_hint={'right':1,'top':1}
graph.pos_hint={'x':0.05,'top':1}
def moveRight(obj):
global xmin
global xmax
global xGlobalmax
xmin=xmin+.5
xmax=xmax+.5
graph.xmin=xmin
graph.xmax=xmax
percent = 1-(xGlobalmax-xmin)/xGlobalmax
video.seek(percent)
btnRight.bind(on_release=moveRight)
def moveLeft(obj):
global xmin
global xmax
global xGlobalmax
xmin=xmin-.5
xmax=xmax-.5
graph.xmin=xmin
graph.xmax=xmax
percent = 1-(xGlobalmax-xmin)/xGlobalmax
video.seek(percent)
btnLeft.bind(on_release=moveLeft)
self.add_widget(graph)
self.add_widget(video)
示例2: playVideo
# 需要导入模块: from kivy.garden.graph import Graph [as 别名]
# 或者: from kivy.garden.graph.Graph import pos_hint [as 别名]
def playVideo(self,FourthScreen):
#get data for patient
with open('choosePatient.txt','r') as f:
patientName=f.read()
# data = data.split(',')
fileName ='videos/' + patientName + ".mp4"
dataMatrix1 = genfromtxt('DemoEEGFile.txt')
x = dataMatrix1[:,0]
x = x - 5.539
y = dataMatrix1[:,1]
xmin = math.trunc(x[0])
ymin = math.trunc(min(y))#math.trunc(y[0])
xmax = xmin+1
xGlobalmax = math.trunc(x[len(x)-1])
ymax = math.trunc(max(y))#math.trunc(y[len(y)-1])
# create buttons
btnRight = Button(text='Scroll', size_hint=(.05,1),pos_hint={'x':0.45})#,'y':0})
btnLeft = Button(text='Scroll', size_hint=(.05,1),pos_hint={'left':1})
FourthScreen.add_widget(btnRight)
FourthScreen.add_widget(btnLeft)
# create graph
graph = Graph()
plot = LinePlot(mode='line_strip',color=[1,0,0,1])
plot.points = [(x[i],y[i]) for i in xrange(len(x))]
graph.add_plot(plot)
graph.x_ticks_major=.5
graph.xmin=xmin
graph.xmax=xmax
graph.ymin=ymin
graph.ymax=ymax
graph.y_ticks_major=10
graph.xlabel='Time (min)'
graph.ylabel='Brain Wave Amplitude (mV)'
graph.y_grid = True
graph.x_grid = True
graph.size_hint=(0.4,0.9)
graph.x_grid_label=True
graph.y_grid_label=True
# create video player
video = VideoPlayer(source=fileName)
video.play=False
video.size_hint=(0.5,0.9)
video.pos_hint={'right':1,'top':1}
graph.pos_hint={'x':0.05,'top':1}
def moveRight(obj):
global xmin
global xmax
global xGlobalmax
xmin=xmin+.5
xmax=xmax+.5
graph.xmin=xmin
graph.xmax=xmax
percent = 1-(xGlobalmax-xmin)/xGlobalmax
video.seek(percent)
btnRight.bind(on_release=moveRight)
def moveLeft(obj):
global xmin
global xmax
global xGlobalmax
xmin=xmin-.5
xmax=xmax-.5
graph.xmin=xmin
graph.xmax=xmax
percent = 1-(xGlobalmax-xmin)/xGlobalmax
video.seek(percent)
btnLeft.bind(on_release=moveLeft)
FourthScreen.add_widget(graph)
FourthScreen.add_widget(video)