wxPython窗口z-order设置

本文介绍了如何在wxPython中设置窗口的Z-order,包括使用pywin32调用Windows API以及使用wx.Frame的wx.Raise()方法实现窗口置顶。wx.Raise()方法在某些情况下可能有限制,可以在wx.Frame初始化时设置属性以保持窗口始终置顶。
摘要由CSDN通过智能技术生成

使用wxpython写的界面程序其实也是可以设置Z-order的。
可以使用pywin32模块调用win32的API实现,使用方法不在赘述。

如果仅仅是想将窗口置顶(放在其他窗口上面,Z-order顶部),有一个简单的方法:

在wx.Frame中调用一下这个方法

self.ToggleWindowStyle(wx.STAY_ON_TOP)

或者

self.SetWindowStyle(wx.STAY_ON_TOP)

注意,wx.Raise()的方法是有限制的,如下的Remark

 virtual void wxWindow::Raise()      [virtual]
 Raises the window to the top of the window hierarchy (Z-order).
 Notice that this function only requests the window manager to raise this window to the top of Z-order.
 Depending on its configuration, the window manager may raise the window, not do it at all or indicate that a window requested to be raised in some other way, e.g. by flashing its icon if it is minimized.
 Remarks:
This function only works for wxTopLevelWindow-derived classes.

如果始终置顶,可以在wx.Frame init里面加入属性,如

def __init__(self,parent&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值