Hello, if you add a SlipInfoText object to the Slipmap, is there a way to dynamically update the text?
Thanks,
Bill
Hello, if you add a SlipInfoText object to the Slipmap, is there a way to
dynamically update the text?
I think you can just add_object the same thing again - using the same key
- and it will get the effect you’re after. I think you could probably
also keep the object around (rather than just constructing it in the
arguments to add_object) and update its text attribute to ge tthe same
effect.
Sorry, just guessing from existing code in the cuav module here
Bill
Yours,
Thanks Peter. I was able to make the update work, but I am getting unexpected results.
sm = MPslipMap(…
…)
rssitext = SlipInfoText(‘rssikey’, ‘startText’)
sm.add_object(rssitext)
#now I get a integer, convert it to string and use to update
updateText = str(msg.rssi)
rssitext.update(SlipInfoText(‘rssikey’, updateText)
sm.add_object(rssitext)
This works but if I have a integer of say 253 it is displayed in the text box as
2
5
3
Its as if I have 3 strings each followed by a newline character.
I am clueless why this is happening, if anyone could offer me one I would appreciate it
Bill
Its as if I have 3 strings each followed by a newline character.
I am clueless why this is happening, if anyone could offer me one I would
appreciate it
Try making the initial value 5 characters long. Do you still get that
effect?
Bill
Peter
Yes, still get the same behavior.
The SlipInfoText box has a drop down menu and I have found if the string
you print to it has two words separated by a space like ‘it is’ they will print like
it
is
the first word is visible while the second word can be viewed by clicking the dropdown arrow.
The first word must have at least 2 characters.
So I have found, and I know this is a complete cluge, that I can get the results I want by
creating the update information like this:
updateText = str(msg.rssi) + ’ a’
the a is arbitrary. The updating information is visible in the textbox and you can
view the ’ a’ if you want by clicking the dropdown arrow.
Im not sure what the original intent was so not positive but think there is a wee bug
in the update method.