久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='ETn4s'></small><noframes id='ETn4s'>

    <legend id='ETn4s'><style id='ETn4s'><dir id='ETn4s'><q id='ETn4s'></q></dir></style></legend>
      <bdo id='ETn4s'></bdo><ul id='ETn4s'></ul>

    <tfoot id='ETn4s'></tfoot>
  1. <i id='ETn4s'><tr id='ETn4s'><dt id='ETn4s'><q id='ETn4s'><span id='ETn4s'><b id='ETn4s'><form id='ETn4s'><ins id='ETn4s'></ins><ul id='ETn4s'></ul><sub id='ETn4s'></sub></form><legend id='ETn4s'></legend><bdo id='ETn4s'><pre id='ETn4s'><center id='ETn4s'></center></pre></bdo></b><th id='ETn4s'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ETn4s'><tfoot id='ETn4s'></tfoot><dl id='ETn4s'><fieldset id='ETn4s'></fieldset></dl></div>

      復(fù)制到剪貼板的圖像不會(huì)在 Linux 上保留

      Image copied to clipboard doesn#39;t persist on Linux(復(fù)制到剪貼板的圖像不會(huì)在 Linux 上保留)

        <bdo id='0bjiq'></bdo><ul id='0bjiq'></ul>

          <tbody id='0bjiq'></tbody>
        <tfoot id='0bjiq'></tfoot>
        <i id='0bjiq'><tr id='0bjiq'><dt id='0bjiq'><q id='0bjiq'><span id='0bjiq'><b id='0bjiq'><form id='0bjiq'><ins id='0bjiq'></ins><ul id='0bjiq'></ul><sub id='0bjiq'></sub></form><legend id='0bjiq'></legend><bdo id='0bjiq'><pre id='0bjiq'><center id='0bjiq'></center></pre></bdo></b><th id='0bjiq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0bjiq'><tfoot id='0bjiq'></tfoot><dl id='0bjiq'><fieldset id='0bjiq'></fieldset></dl></div>
        1. <small id='0bjiq'></small><noframes id='0bjiq'>

              <legend id='0bjiq'><style id='0bjiq'><dir id='0bjiq'><q id='0bjiq'></q></dir></style></legend>
                本文介紹了復(fù)制到剪貼板的圖像不會(huì)在 Linux 上保留的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                我正在嘗試將圖像保存到系統(tǒng)剪貼板,所以我寫(xiě)了一些這樣的代碼:

                I'm trying to save an image to the system clipboard, so I wrote some code like this:

                #!/usr/bin/python3
                
                from PyQt5.Qt import QApplication
                from PyQt5.QtWidgets import QWidget, QPushButton
                from PyQt5.Qt import QImage
                
                import sys
                
                class MyWidget(QWidget):
                    def __init__(self):
                        super(MyWidget, self).__init__()
                        self.button = QPushButton(self)
                        self.button.clicked.connect(self.copyPicToClip)
                
                    def copyPicToClip(self):
                        image = QImage('./test.jpg')
                        QApplication.clipboard().setImage(image)
                        self.close()
                
                if __name__ == '__main__':
                    a = QApplication(sys.argv)
                
                    myW = MyWidget()
                    myW.show()
                
                    a.exec()
                

                遺憾的是,我發(fā)現(xiàn)它根本不起作用.然后我試圖找到解決方案.我嘗試的第一件事是:

                Sadly, I found it doesn't work at all. Then I tried to find a solution. The first thing I tried was this:

                def copyPicToClip(self):
                    image = QImage('./test.jpg')
                    QApplication.clipboard().setImage(image)
                    # self.close()
                

                在這之后,我才發(fā)現(xiàn)它起作用了,但是窗口沒(méi)有自動(dòng)關(guān)閉.

                After this, I just found that it worked, but the window does not close automatically.

                然后我嘗試復(fù)制文本:

                #!/usr/bin/python3
                
                from PyQt5.Qt import QApplication, QClipboard
                from PyQt5.QtWidgets import QWidget, QPushButton
                from PyQt5.Qt import QImage
                
                import sys
                
                class MyWidget(QWidget):
                    def __init__(self):
                        super(MyWidget, self).__init__()
                        self.button = QPushButton(self)
                        self.button.clicked.connect(self.copyPicToClip)
                        QApplication.clipboard().dataChanged.connect(self.testFunc)
                
                    def copyPicToClip(self):
                        image = QImage('./test.jpg')
                        QApplication.clipboard().setImage(image)
                
                    def testFunc(self):
                        print('Here')
                        self.close()
                
                if __name__ == '__main__':
                    a = QApplication(sys.argv)
                
                    myW = MyWidget()
                    myW.show()
                
                    a.exec()
                

                很遺憾,它又失敗了.

                所以,如果我提前關(guān)閉應(yīng)用程序,圖像將不會(huì)保存到剪貼板.但我想在將圖像復(fù)制到剪貼板后關(guān)閉它.

                So, it seems that if I close the application to early, the image won't be saved to the clipboard. But I want to close it after copying the image to the clipboard.

                有什么建議嗎?

                (PyQt5,ubuntu 16.10,如果有幫助的話).

                (PyQt5, ubuntu 16.10, if helps).

                推薦答案

                不幸的是,這是 Linux 上的正常"行為.默認(rèn)情況下,當(dāng)應(yīng)用程序關(guān)閉時(shí),剪貼板數(shù)據(jù)不會(huì)被保留.此問(wèn)題的通常解決方法是安裝剪貼板管理器.對(duì)于 Ubuntu,請(qǐng)參閱此 wiki 文章了解更多詳細(xì)信息:

                Unfortunately for you, this is "normal" behaviour on Linux. By default, clipboard data is not persisted when an application closes. The usual work-around for this problem is to install a clipboard manager. For Ubuntu, see this wiki article for more details:

                • Ubuntu Wiki:剪貼板持久性

                (注意:我自己并沒(méi)有實(shí)際測(cè)試過(guò)任何建議的解決方案,所以我不知道它們中的任何一個(gè)是否適用于 PyQt).

                (NB: I have not actually tested any of the suggested solutions myself, so I don't know whether any of them will work with PyQt).

                基本問(wèn)題是在 Linux 上,剪貼板只存儲(chǔ)對(duì)底層數(shù)據(jù)的引用.這在存儲(chǔ)方面非常有效,因?yàn)橹挥性诳蛻舳顺绦驅(qū)嶋H請(qǐng)求數(shù)據(jù)時(shí)才會(huì)復(fù)制數(shù)據(jù).但是當(dāng)然,如??果源應(yīng)用程序關(guān)閉,引用將失效,剪貼板將變?yōu)榭?

                The basic problem is that on Linux, the clipboard only stores a reference to the underlying data. This is very efficient in terms of storage, because the data is only copied when the client program actually requests it. But of course if the source application closes, the reference will be invalidated, and the clipboard will become empty.

                這篇關(guān)于復(fù)制到剪貼板的圖像不會(huì)在 Linux 上保留的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                PyQt progress jumps to 100% after it starts(PyQt 啟動(dòng)后進(jìn)度躍升至 100%)
                How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動(dòng)時(shí),yaxis 刻度標(biāo)簽應(yīng)該可見(jiàn)
                `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時(shí)顯示進(jìn)度條?)

                <tfoot id='Op2gu'></tfoot>
              • <i id='Op2gu'><tr id='Op2gu'><dt id='Op2gu'><q id='Op2gu'><span id='Op2gu'><b id='Op2gu'><form id='Op2gu'><ins id='Op2gu'></ins><ul id='Op2gu'></ul><sub id='Op2gu'></sub></form><legend id='Op2gu'></legend><bdo id='Op2gu'><pre id='Op2gu'><center id='Op2gu'></center></pre></bdo></b><th id='Op2gu'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Op2gu'><tfoot id='Op2gu'></tfoot><dl id='Op2gu'><fieldset id='Op2gu'></fieldset></dl></div>
                    <legend id='Op2gu'><style id='Op2gu'><dir id='Op2gu'><q id='Op2gu'></q></dir></style></legend>

                      <small id='Op2gu'></small><noframes id='Op2gu'>

                        <bdo id='Op2gu'></bdo><ul id='Op2gu'></ul>
                          <tbody id='Op2gu'></tbody>
                        • 主站蜘蛛池模板: 国精产品一品二品国精在线观看 | 欧美福利网站 | 国产在线一区二 | 久久国产成人午夜av影院武则天 | 97精品国产| 亚洲精品日韩欧美 | 成人亚洲 | 久久久99精品免费观看 | 欧美激情va永久在线播放 | 天堂精品视频 | 不卡av电影在线播放 | 国产午夜精品久久久久 | 久久精品国产精品青草 | 日韩免费av一区二区 | 在线成人精品视频 | 成人深夜福利在线观看 | 青青草网站在线观看 | 超碰男人天堂 | 日日噜噜夜夜爽爽狠狠 | 日本不卡免费新一二三区 | 欧美国产精品久久久 | 性一交一乱一伦视频免费观看 | 精品久久一区 | 亚洲天堂色 | 中文字幕日韩欧美 | 在线欧美小视频 | 成人国产网站 | 欧美一级二级三级 | 精品一区二区观看 | 国产视频精品在线 | 亚洲免费一区 | 成人免费大片黄在线播放 | 99久久婷婷国产综合精品电影 | 国产精品一区二区三区在线 | 国产电影一区二区在线观看 | 久久国产视频一区 | 91在线精品播放 | 国产成人免费视频网站高清观看视频 | 国产91综合一区在线观看 | 日日av| 色屁屁在线观看 |