Here is my full code. Actually, I am trying to read a file having x, y positions and want to plot those positions on canvas. Here I am trying to use graphs from kivy. I already did this with matplot.
from
kivy.app import App
from kivy.uix.widget import Widget
from kivy.garden.graph import Graph, MeshLinePlot
import math
class MistakeCorrect(Widget):
def __init__(self, **kwargs):
super(MistakeCorrect, self).__init__(**kwargs)
def draw(self):
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,x_ticks_major=25,
y_ticks_major=1,y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1)
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x, math.sin(x / 10.)) for x in range(0, 101)]
graph.add_plot(plot)
class MistakeApp(App):
def build(self):
mis = MistakeCorrect()
mis.draw()
return mis
if __name__ == '__main__':
MistakeApp().run()
.kv file
#:kivy 1.9.0
<MistakeCorrect>:
#canvas:
# Color:
# rgba: 1, 1, 1, .7
# Rectangle:
# pos: self.center_x / 8 , self.center_y / 2
# size: 370, 370
Slider:
orientation: 'horizontal'
pos: 460, 300
width: 250
id: param
min: 0
max: 50
value: 25
step: 1
Button:
text: 'False!'
pos: 500, 50
size: 75, 75
background_color:1,0, 0,1
Button:
text: 'True!'
pos: 650, 50
size: 75, 75
background_color:0,1, 0,1
On Wednesday, 1 July 2015 11:37:02 UTC+1, Alexander Taylor wrote:
Post a full, working example.
On Wednesday, 1 July 2015 10:17:15 UTC+1, Shruti Chandra wrote:
On Wednesday, 1 July 2015 10:17:15 UTC+1, Shruti Chandra wrote: