Open wilsoc5 opened 6 years ago
Please provide an appropriate call to the BuildTable function so that it's possible to see the problem. Actually, it would probably be more useful to post this question to the VPython forum
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
where many more people would see it; perhaps someone has already found a way to do something like this.
Thanks, I didn't know about the forum. Minimal working example has been updated in the original comment.
I no longer get the javascript error, so that was probably something else. I'll poke around the forums for the table issue.
It seems like this has come up before: https://groups.google.com/forum/?fromgroups&hl=en#!searchin/vpython-users/html%7Csort:date/vpython-users/yA6s0V1UlY0/UI13ofxqBgAJ
When I am thinking about it I come to the question wether or not it would be helpful to have more access to html-control.
Not sure what is meant by "html-control", but as you saw, you can use jquery, which is surely more powerful than Wx. Incidentally, one of the many reasons we had to abandon Classic VPython (though not the determining issue) was that Wx for Python 3 was delayed and delayed and delayed.
As a workaround for anyone else with this issue, I was able to do the following:
scene.caption += '<table>'
wtext1 = vpython.wtext(text='initial text 1')
scene.caption += '<tr><td><div id="1">initial text 1</div></td></tr>'
wtext2 = vpython.wtext(text='initial text 2')
scene.caption += '<tr><td><div id="2">initial text 2</div></td></tr>'
scene.caption += '</table>'
Adding directly to scene.caption doesn't prematurely insert a closing tag, and it turns out wtexts are implemented by a div with id=1, id=2, etc incrementing each time a new wtext is made. Adding directly to scene.caption will also remove this special
The end result is a table with several embedded wtext fields.
Another workaround is making a wtext with a text field that contains HTML table tags etc., but every time this text field is updated any opened dropdown menus will be closed, so may not work for you.
I would like to layout some wtext objects into a table so that I may edit them dynamically based on user feedback. You can somewhat think of it as a read-only excel spreadsheet in HTML form, where all the values are determined by user input via sliders and other controls.
So I attempted to do something like:
What ends up happening is that the first
wtext
entrytdHeaderXPosText
closes the opened table. Additionally, all further Widget implementation is killed due to a javascript error: