日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

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

新聞中心

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

1、為了讓菜單選項(xiàng)和工具欄在用戶點(diǎn)擊它們時(shí)啟動(dòng),需要將信號(hào)與內(nèi)置插槽連接起來(lái)。

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

菜單和工具欄中最常用的信號(hào)是.triggered()。用戶每次點(diǎn)擊菜單選項(xiàng)或工具欄按鈕都會(huì)發(fā)出這個(gè)信號(hào)。

實(shí)例

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信號(hào)和插槽的連接方法,希望對(duì)大家有所幫助。更多Python學(xué)習(xí)指路:創(chuàng)新互聯(lián)python教程

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


分享標(biāo)題:創(chuàng)新互聯(lián)Python教程:python PyQt信號(hào)和插槽的連接
鏈接URL:http://www.5511xx.com/article/dhipooo.html