开发者

PyQt - how to get top level parent from the given widget?

开发者 https://www.devze.com 2023-03-09 08:47 出处:网络
How can given widget access it\'s oldest parent, which is top level widget. I need to .showMin开发者_如何转开发imized() it.

How can given widget access it's oldest parent, which is top level widget.

I need to .showMin开发者_如何转开发imized() it.

Now I am using

self.parent().parent().parent().showMinimized()

But it seem not to be the best way for this.

If it it moved, I need to change number of parent manually.

Is there a way to access top level widget?


If you're just trying to get to the window widget, there's QWidget.window().

self.window().showMinimized()
0

精彩评论

暂无评论...
验证码 换一张
取 消