Python Forum

Full Version: Tkinter Font Color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
mystr = StringVar()
# then you need to use textvariable=mystr in widget T
# to change content of mystr:
mystr.set(value)
(Mar-27-2018, 10:52 AM)Larz60+ Wrote: [ -> ]
mystr = StringVar()
# then you need to use textvariable=mystr in widget T
# to change content of mystr:
mystr.set(value)

i might be in way over my head but now im working on a live graph. the values im trying to load into the graph are going to be exactly like this,


1.0 16:08"PM" *03-27-18
2.5 16:08"PM" *03-27-18
11.5 16:08"PM" *03-27-18
etc,
but never
111.55 16:08"PM" *03-27-18

im trying to figure out how to get the graph to load the value. im working from a segment of code from a live graph tutorial and it works if i format the numebrs like this,

1,2
2,3
3,6
4,9

the chuck of code that is handles this im not sure how it works. heres the code i think handles this but im not sure what to do for this to work.

f = Figure(figsize=(5,5), dpi=100)
a = f.add_subplot(111)


def animate(i):
    pullData = open("sampleText.txt","r").read()
    dataList = pullData.split('\n')
    xList = []
    yList = []
    

    for eachLine in dataList:
        if len(eachLine) > 1:
            x, y = eachLine.split(',',1)
            xList.append(int(x))
            yList.append(int(y))
            
    a.clear()
    a.plot(xList, yList)
Pages: 1 2