简体   繁体   English

在traitsui中查找编辑器的当前位置

[英]Finding current location of editors in traitsui

Is there a way to tell what is the current location of my editor on the screen? 有没有办法告诉我编辑器在屏幕上的当前位置? Also acceptable would be a way to tell what is the current location of an editor within the traitsui window in which it is situated. 告诉编辑器当前所在的traitsui窗口中当前位置的方法也是可以接受的。

The use case is this: I am trying to make movies from mayavi views (and I don't care if it is a bit of a hack). 用例是这样的:我正尝试从mayavi的视角制作电影(并且我不在乎它是否有点漏洞)。 Digging around in the code, there are some low level idiosyncracies that make it very difficult to actually get mayavi to do this nicely. 在代码中进行挖掘,有一些底层的特质,这使得很难让mayavi很好地做到这一点非常困难。 But, one option is to just use X11 grabbing -- which is fairly hacky but for now suits my purposes. 但是,一种选择是仅使用X11抓取-相当hacky,但现在适合我的目的。 This depends on the relative position of the mayavi scene within the traitsui window, which is by the design of traitsui completely not transparent to the programmer. 这取决于mayavi场景在traitsui窗口内的相对位置,这是由traitsui的设计完全不对程序员透明的。

我终于找到了:

x,y=editor.control.GetScreenPosition()

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

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