日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python PyQt信號和插槽的連接

1、為了讓菜單選項和工具欄在用戶點擊它們時啟動,需要將信號與內(nèi)置插槽連接起來。

2、QAction物體可以發(fā)出各種信號。triggered()與插槽連接。

菜單和工具欄中最常用的信號是.triggered()。用戶每次點擊菜單選項或工具欄按鈕都會發(fā)出這個信號。

實例

class Window(QMainWindow):
    # Snip...
    def newFile(self):
        # Logic for creating a new file goes here...
        self.centralWidget.setText("File > New clicked")
 
    def openFile(self):
        # Logic for opening an existing file goes here...
        self.centralWidget.setText("File > Open... clicked")
 
    def saveFile(self):
        # Logic for saving a file goes here...
        self.centralWidget.setText("File > Save clicked")
 
    def copyContent(self):
        # Logic for copying content goes here...
        self.centralWidget.setText("Edit > Copy clicked")
 
    def pasteContent(self):
        # Logic for pasting content goes here...
        self.centralWidget.setText("Edit > Paste clicked")
 
    def cutContent(self):
        # Logic for cutting content goes here...
        self.centralWidget.setText("Edit > Cut clicked")
 
    def helpContent(self):
        # Logic for launching help goes here...
        self.centralWidget.setText("Help > Help Content... clicked")
 
    def about(self):
        # Logic for showing an about dialog content goes here...
        self.centralWidget.setText("Help > About... clicked")

以上就是python PyQt信號和插槽的連接方法,希望對大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)python教程

本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。


分享題目:創(chuàng)新互聯(lián)Python教程:python PyQt信號和插槽的連接
文章源于:http://www.dlmjj.cn/article/dhipooo.html