linux 窗口z order,wxPython窗口z-order设置

使用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=None,id=-1,

pos=wx.DefaultPosition,

title='Hello',

style=wx.DEFAULT_FRAME_STYLE^(wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX) | wx.STAY_ON_TOP):

enjoy ^_^

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值