简体   繁体   English

如何修复 canvas 的 position 和 vpython 中的图形?

[英]how to fix the position of canvas and graph in vpython?

Before I say it, Sorry for my poor English.在我说之前,对不起我的英语不好。 I'm making an orbit simulation with vpython, because the earth science teacher asked me to.我正在使用 vpython 进行轨道模拟,因为地球科学老师要求我这样做。

The link below is the result of my work so far.下面的链接是我迄今为止工作的结果。

https://glowscript.org/#/user/sungho2574/folder/MyPrograms/program/2 https://glowscript.org/#/user/sungho2574/folder/MyPrograms/program/2

Unfortunately, I can't watch the simulation and the graphs simultaneously, so I want to put two graphs side by side and put them right under the canvas.不幸的是,我不能同时观看模拟和图表,所以我想将两个图表并排放置,并将它们放在 canvas 的正下方。 Also, I want to put "setting" next to the 3d canvas.另外,我想把“设置”放在 3d canvas 旁边。

I tried various ways, but nothing worked.我尝试了各种方法,但没有任何效果。

And I found this vpython 6 link.我找到了这个 vpython 6 链接。 https://vpython.org/contents/new_features.html https://vpython.org/contents/new_features.html

In this link, I could find the GUI image that canvas and setting are located side by side.在这个链接中,我可以找到 canvas 和设置并排放置的 GUI 图像。 But I also failed to work with it.但我也没有使用它。

  1. Can I put canvas or whatever freely in vpython 7?我可以在 vpython 7 中自由放置 canvas 或其他任何东西吗?

  2. Or in vpython 6?还是在 vpython 6 中?

VPython 6 ended many years ago. VPython 6 多年前就结束了。 VPython 7 exists, but has the same syntax and capabilities as the Web VPython you are using at glowscript.org. VPython 7 存在,但具有与您在glowscript.org 上使用的 Web VPython 相同的语法和功能。 From the documentation on canvases at来自画布上的文档

https://www.glowscript.org/docs/VPythonDocs/canvas.html https://www.glowscript.org/docs/VPythonDocs/canvas.html

is this information on aligning canvases (and graphs):这是关于对齐画布(和图表)的信息:

align Set to "left" (canvas forced to left side of window), "right" (canvas forced to right side of window), or "none" (the default alignment). align 设置为“left”(画布强制到窗口左侧)、“right”(画布强制到窗口右侧)或“none”(默认对齐方式)。 If you have a single canvas, setting align to "left" causes the canvas caption to be displayed to the right of the canvas.如果您有一个 canvas,将对齐设置为“左”会导致 canvas 标题显示在 canvas 的右侧。 If you want to place a graph to the right of a canvas, set the canvas align attribute to the string "left" and the graph align attribute to the string "right".如果要将图形放置在 canvas 的右侧,请将 canvas 对齐属性设置为字符串“left”,将图形对齐属性设置为字符串“right”。 If the window is too narrow, the object that is on the right will be displayed below the other object.如果 window 太窄,右边的 object 会显示在另一个 object 的下方。 If you want to place a graph to the right of the canvas but keep the canvas caption underneath the canvas, create the graph first with align set to "right" and activate the graph by plotting something in it, then create the canvas without specifying its value of align. If you want to place a graph to the right of the canvas but keep the canvas caption underneath the canvas, create the graph first with align set to "right" and activate the graph by plotting something in it, then create the canvas without specifying its对齐的值。 Another option is to specify align='left' for all canvases and graphs, in which case they will abut each other.另一种选择是为所有画布和图形指定 align='left',在这种情况下,它们将相互邻接。

Here is an example (make the window wide): https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/HardSphereGas-VPython这是一个示例(使 window 变宽): https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/HardSphereGas-VPython

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM