Hello everyone,
I'm new here, and also quite new with Python. I'have been only for some months learning it and enjoying it :). Right now i'm writing a GUI for my master thesis in physics education and need some help. Basically i have made a small measuring devices with a RasPi and different sensors, and I am making a GUI for showing the kids the data live while we are measuring. That has worked quite well with a TkAgg canvas and an embedded pyplot figure and an animation.
For retrieving the data I've used the after method like this:
And here comes finally my question: I've tried to make a button for reseting the data or for interacting somehow with it but once the after loop is on, it doesn't care anymore about global variables. It simply keeps running with the values it collected at the beginning. So is there any way of forcing the tick function to update the global values at some point?
I'm not sure if my question even makes sense at all. I'm still learning and haven't reached yet a lot of stuff like classes etc, but I'm open to every advice and piece of info you can give me :)
Thanks in advance and have a nice day.
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
[quote="omrot" pid="49272" dateline="1528352330"]Hello everyone, I'm new here, and also quite new with Python. I'have been only for some months learning it and enjoying it :). Right now i'm writing a GUI for my master thesis in physics education and need some help. Basically i have made a small measuring devices with a RasPi and different sensors, and I am making a GUI for showing the kids the data live while we are measuring. That has worked quite well with a TkAgg canvas and an embedded pyplot figure and an animation. For retrieving the data I've used the after method like this:
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
OMG Now I've made amess here XD
I'm new here, and also quite new with Python. I'have been only for some months learning it and enjoying it :). Right now i'm writing a GUI for my master thesis in physics education and need some help. Basically i have made a small measuring devices with a RasPi and different sensors, and I am making a GUI for showing the kids the data live while we are measuring. That has worked quite well with a TkAgg canvas and an embedded pyplot figure and an animation.
For retrieving the data I've used the after method like this:
def tick(): single_anzeige=random.random()*100 values_anzeige.append(single_anzeige) anzeige.config(text='%07.3f °C' % (single_anzeige)) values_y.append(single_anzeige) if len(values_anzeige)%5 == 0 else 0 anzeige.after(100, tick)Btw, for testing i'm collecting right now just random numbers generated with the random function. Values are collected in two variables (values anzeige for the raw data and values_y that are shown later in the graph).
And here comes finally my question: I've tried to make a button for reseting the data or for interacting somehow with it but once the after loop is on, it doesn't care anymore about global variables. It simply keeps running with the values it collected at the beginning. So is there any way of forcing the tick function to update the global values at some point?
I'm not sure if my question even makes sense at all. I'm still learning and haven't reached yet a lot of stuff like classes etc, but I'm open to every advice and piece of info you can give me :)
Thanks in advance and have a nice day.
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
[quote="omrot" pid="49272" dateline="1528352330"]Hello everyone, I'm new here, and also quite new with Python. I'have been only for some months learning it and enjoying it :). Right now i'm writing a GUI for my master thesis in physics education and need some help. Basically i have made a small measuring devices with a RasPi and different sensors, and I am making a GUI for showing the kids the data live while we are measuring. That has worked quite well with a TkAgg canvas and an embedded pyplot figure and an animation. For retrieving the data I've used the after method like this:
def tick(): single_anzeige=random.random()*100 values_anzeige.append(single_anzeige) anzeige.config(text='%07.3f °C' % (single_anzeige)) values_y.append(single_anzeige) if len(values_anzeige)%5 == 0 else 0 anzeige.after(100, tick)Btw, for testing i'm collecting right now just random numbers generated with the random function. Values are collected in two variables (values anzeige for the raw data and values_y that are shown later in the graph). And here comes finally my question: I've tried to make a button for reseting the data or for interacting somehow with it but once the after loop is on, it doesn't care anymore about global variables. It simply keeps running with the values it collected at the beginning. So is there any way of forcing the tick function to update the global values at some point? I'm not sure if my question even makes sense at all. I'm still learning and haven't reached yet a lot of stuff like classes etc, but I'm open to every advice and piece of info you can give me :) Thanks in advance and have a nice day.
Somehow I have made it work by avoiding reassigning the values to different objects, but making only in-place changes.
OMG Now I've made amess here XD