本文整理匯總了Python中kivy.garden.graph.Graph.size_hint方法的典型用法代碼示例。如果您正苦於以下問題:Python Graph.size_hint方法的具體用法?Python Graph.size_hint怎麽用?Python Graph.size_hint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy.garden.graph.Graph
的用法示例。
在下文中一共展示了Graph.size_hint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from kivy.garden.graph import Graph [as 別名]
# 或者: from kivy.garden.graph.Graph import size_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 size_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)