Python PyQt5.QtCore.Qt 模块,WA_TranslucentBackground() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用PyQt5.QtCore.Qt.WA_TranslucentBackground()

项目:QQ_ucics    作者:hustdebug    | 项目源码 | 文件源码
def __init__(self, parent = None):
        super(Ucics, self).__init__(parent)
        desktop = QApplication.desktop()
        self.dwidth = desktop.width()    # ??????
        self.dheight = desktop.height()    # ??????
        self.setupUi(self)    # ?????
        self.initPos()    # ?????
        self.initSkin()    # ?????
        # ???? ????
        self.setAttribute(Qt.WA_TranslucentBackground)
        # self.installEventFilter(self)
        # self.headLabel.installEventFilter(self)

    # win32gui.PostMessage(hWnd,message,wParam,lParam)
#    def nativeEvent(self, eventType, message):
#        retval, result = super(Ucics, self).nativeEvent(eventType, message)
#        if eventType == "windows_generic_MSG":
#            msg = ctypes.wintypes.MSG.from_address(message.__int__())
#             print("hWnd: ", msg.hWnd)
#             print("lParam: ", msg.lParam)
#             print("message: ", msg.message)
#             print("pt: ", msg.pt)
#             print("time: ", msg.time)
#             print("wParam: ", msg.wParam)
#        return retval, result
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setGeometry(100, 100, 320, 480)
        self.setFixedSize(320, 480)
        self.setWindowTitle("ShuffleNet")
        #self.setWindowFlags(Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground, True)

        self.iTunes = iTunes()
        self.r_song = []

        self.currentSongID = '-1'
        self.songAdded = False

        pickle_file = "itl.p"
        self.itl = pickle.load(open(pickle_file, "rb"))

        self.pm = PredictModel()
        self.song_queue = []
        self.song_changing = False

        input_file = open(os.path.join("", 'input.p'), 'rb')
        input_file_data = pickle.load(input_file)
        self.int_to_key = input_file_data['itk']
        self.key_to_int = input_file_data['kti']

        self.best_recommend = None

        self.drawUI()
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def init_ui(self):
        self.setFixedSize(700,600)
        self.assemble()
        self.set_styles()
        self.aux = QPoint(200,300)
        self.setWindowFlags(Qt.FramelessWindowHint)
        # self.setAttribute(Qt.WA_TranslucentBackground)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def __init__(self):
        super(Recorder, self).__init__()

        self.setWindowFlags(Qt.CustomizeWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)

        self.layout_outer = QVBoxLayout()
        self.widget_inner = QWidget()
        self.layout_inner = QVBoxLayout()
        self.layout_bar = QHBoxLayout()
        self.layout_timer = QHBoxLayout()
        self.layout_btns = QHBoxLayout()

        self.widget_inner.setLayout(self.layout_inner)
        self.layout_outer.addWidget(self.widget_inner)

        self.layout_inner.addLayout(self.layout_bar)
        self.layout_inner.addStretch(-1)
        self.layout_inner.addLayout(self.layout_timer)
        self.layout_inner.addLayout(self.layout_btns)

        self.setLayout(self.layout_outer)

        self.style = """
            .QWidget{
                background-color: #080f1c;
                border-radius: 10px;
            }
        """

        self.screencast_number = 0

        self.widget_inner.setStyleSheet(self.style)

        self.init_bar()
        self.init_timer()
        self.init_buttons()
        self.setFixedWidth(self.btn_size.width()*3+50)

        self.dir_name = "."
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def __init__(self, parent=None, *args, **kwargs):
        super(WaitDialog, self).__init__(parent)
        self.label = QLabel(self)
        self.label.setAlignment(Qt.AlignCenter)
        self.setFixedSize(551, 401)
        self.setWindowOpacity(0.5)  # set transparent
        self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)  # background transparent
        self.setContentsMargins(0, 0, 0, 0)
        config = Config()
        self.movie = QMovie(os.path.join(config.images, 'wait.gif'))
        self.label.setMovie(self.movie)
        self.movie.start()
项目:fomod-designer    作者:GandaG    | 项目源码 | 文件源码
def open_path(self, path):
        """
        Method used to open a path in the main window - closes the intro window and show the main.

        :param path: The path to open.
        """
        main_window = MainFrame()
        self_center = self.mapToGlobal(self.rect().center())
        main_center = main_window.mapToGlobal(main_window.rect().center())
        main_window.move(self_center - main_center)
        main_window.open(path)
        main_window.show()
        self.close()
        if self.settings_dict["General"]["tutorial_advanced"]:
            main_window.setEnabled(False)
            tutorial = loadUi(join(cur_folder, "resources/templates/tutorial_advanced.ui"))
            tutorial.frame_node.resize(main_window.node_tree_view.size())
            tutorial.frame_node.move(
                main_window.node_tree_view.mapTo(main_window, main_window.node_tree_view.pos())
            )
            tutorial.frame_preview.resize(main_window.tabWidget.size())
            tutorial.frame_preview.move(
                main_window.tabWidget.mapTo(main_window, main_window.tabWidget.pos())
            )
            tutorial.frame_prop.resize(main_window.dockWidgetContents.size())
            tutorial.frame_prop.move(
                main_window.dockWidgetContents.mapTo(main_window, main_window.dockWidgetContents.pos())
            )
            tutorial.frame_child.resize(main_window.dockWidgetContents_3.size())
            tutorial.frame_child.move(
                main_window.dockWidgetContents_3.mapTo(main_window, main_window.dockWidgetContents_3.pos())
            )
            tutorial.button_exit.clicked.connect(lambda: main_window.setEnabled(True))
            tutorial.button_exit.clicked.connect(tutorial.close)
            tutorial.setParent(main_window)
            tutorial.setWindowFlags(Qt.FramelessWindowHint | Qt.Dialog)
            tutorial.setAttribute(Qt.WA_TranslucentBackground)
            main_center = main_window.mapToGlobal(main_window.rect().center())
            tutorial_center = tutorial.mapToGlobal(tutorial.rect().center())
            tutorial.move(main_center - tutorial_center)
            tutorial.setEnabled(True)
            tutorial.exec_()
            self.settings_dict["General"]["tutorial_advanced"] = False

        self.settings_dict["General"]["show_intro"] = not self.check_intro.isChecked()
        self.settings_dict["General"]["show_advanced"] = self.check_advanced.isChecked()
        makedirs(join(expanduser("~"), ".fomod"), exist_ok=True)
        with open(join(expanduser("~"), ".fomod", ".designer"), "w") as configfile:
            set_encoder_options("json", indent=4)
            configfile.write(encode(self.settings_dict))