recipe-334779.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:code 作者: ActiveState 项目源码 文件源码
def set_alpha(self, alpha=100, colorkey=0, mask=False):
        """ Sets the transparency of the window. """
        if self.alpha != None:
            if not self._transparency:
                style = win32gui.GetWindowLong(self._hwnd, GWL_EXSTYLE)
                if (style & WS_EX_LAYERED) != WS_EX_LAYERED:
                    style = style | WS_EX_LAYERED
                    win32gui.SetWindowLong(self._hwnd, GWL_EXSTYLE, style)
                self._transparency = True

            if mask and colorkey:
                flags = LWA_COLORKEY
            else:
                flags = LWA_ALPHA
                if colorkey:
                    flags = flags | LWA_COLORKEY

            win_alpha = int(float(alpha)/100*255)
            winxpgui.SetLayeredWindowAttributes(self._hwnd, colorkey,
                                                win_alpha, flags)
            self.alpha = int(alpha)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号