91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

多窗口傳遞信號,無邊框移動,12306驗證碼,pyqt5

發布時間:2020-07-16 13:46:33 來源:網絡 閱讀:988 作者:libinqi456 欄目:編程語言

多窗口傳遞信號,無邊框移動,12306驗證碼,pyqt5
Form1:

from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from Form1 import Ui_Form
import sys,qdarkstyle
import Form2_Main

class Form1_Main( QDialog,Ui_Form):
    def __init__(self):
        super(Form1_Main,self).__init__()
        self.setupUi(self)
        #self.setAttribute(Qt.WA_TranslucentBackground)
        # 設置窗體無邊框
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.pushButton.clicked.connect(self.showFrom2)
        self.pushButton_2.clicked.connect(self.close)

    def showFrom2(self):
        F2_window = Form2_Main.Form2_Main()
        F2_window.Form2_signal.connect(self.showFrom2msg)
        F2_window.show()
        F2_window.exec_()

    def showFrom2msg(self,strs):
        print(strs)

    def mousePressEvent(self, QMouseEvent):
        if QMouseEvent.button() == Qt.LeftButton:
            self.flag = True
            # 獲取鼠標相對窗口的位置
            self.m_Position = QMouseEvent.globalPos() - self.pos()
            QMouseEvent.accept()
            # 更改鼠標圖標
            self.setCursor(QCursor(Qt.OpenHandCursor))

    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.flag:
            # 更改窗口位置
            self.move(QMouseEvent.globalPos()-self.m_Position)
            QMouseEvent.accept()

    def mouseReleaseEvent(self, QMouseEvent):
        self.flag = False
        self.setCursor(QCursor(Qt.ArrowCursor))

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Form1_Main()
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    window.show()
    sys.exit(app.exec_())

多窗口傳遞信號,無邊框移動,12306驗證碼,pyqt5
Form2:

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from Form2 import Ui_Form
import sys,requests,base64,qdarkstyle

class Form2_Main(QDialog,Ui_Form):
    Form2_signal = pyqtSignal(str)
    def __init__(self,parent=None):
        super(Form2_Main,self).__init__(parent)
        self.setupUi(self)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowModality(Qt.ApplicationModal)
        self.setModal(True)
        self.pushButton.clicked.connect(self.get_pic)
        self.pushButton_2.clicked.connect(self.close)

    def backStr(self):
        self.Form2_signal.emit('Form2 message')#驗證成功返回數據

    def get_pic(self):
        url = 'https://kyfw.12306.cn/passport/captcha/captcha-image64?login_site=E&module=login&rand=sjrand'

        try:
            r = requests.get(url)
            print('content: ',r.content)
            dic = r.json()
            print('json:',dic)
            png = base64.b64decode(dic['image'])
            print('png: ',png)
            photo = QPixmap(100,100)
            photo.loadFromData(png)
            self.label.setPixmap(photo)
            self.Form2_signal.emit('Form2 message')  # 驗證成功返回數據

        except Exception as e:
            print('Exception',e)

    def mousePressEvent(self, event):

        if(event.button()==Qt.LeftButton):
            self.flag = True
            self.m_Position = event.globalPos() - self.pos()
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor))

    def mouseMoveEvent(self, event):
        if Qt.LeftButton and self.flag:
            self.move(event.globalPos() - self.m_Position)
            event.accept()

    def mouseReleaseEvent(self, event):
        self.flag = False
        self.setCursor(QCursor(Qt.ArrowCursor))

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Form2_Main()
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    window.show()
    sys.exit(app.exec_())

運行效果:
多窗口傳遞信號,無邊框移動,12306驗證碼,pyqt5

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

永新县| 确山县| 瑞安市| 新津县| 宝应县| 鲁甸县| 苗栗县| 芮城县| 自贡市| 海阳市| 洪江市| 鹤山市| 金门县| 阿巴嘎旗| 色达县| 土默特右旗| 安吉县| 恩平市| 三河市| 吉林省| 永泰县| 长乐市| 德兴市| 平阴县| 明水县| 廊坊市| 耿马| 敦煌市| 广南县| 龙州县| 龙门县| 巴彦淖尔市| 余江县| 镇沅| 陆河县| 祁门县| 民和| 灵武市| 鱼台县| 凤凰县| 高清|