The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Python
 pyqt5

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jy1u18@soton.ac.uk Posted - 06/17/2021 : 12:16:06 PM

import sys
import os
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QLineEdit ,QWidget,QGridLayout,QPushButton,QLabel,QTextBrowser,QDesktopWidget
from PyQt5.QtGui import *
from PyQt5 import QtCore
from PyQt5.QtCore import Qt

#a simple GUI sample
class mainwin(QWidget):
    def __init__(self,parent=None):
        super(mainwin,self).__init__(parent)
        self.main()
    def main(self):
        self.setWindowTitle('MAIN')
        self.label=QLabel(self)
        self.label.setText('MainWindow')
        self.label.setFont(QFont('Arial',15))
        self.resize(300,150)

if __name__=='__main__':
    app = QApplication(sys.argv)
    win=mainwin()
    print('launched')
    win.show()
    sys.exit(app.exec())

when i run a pyqt code in the build-in code builder. the origin will shut down with the code.
I assume it's the 'sys.exit(app.exec())' that trying to close everything?

is there any other way to only close pyqt without affect origin?

Thanks!!
2   L A T E S T    R E P L I E S    (Newest First)
jy1u18@soton.ac.uk Posted - 06/19/2021 : 09:23:02 AM
Thank you so much!!!!!!!!!!!!!!!!!!!!!!!!!!
quote:
Originally posted by Chris D

Change:

sys.exit(app.exec())


To:

app.exec()


I just helped someone with this last week and that was the solution.


Thanks,
Chris Drozdowski
Originlab Technical Support


Chris D Posted - 06/17/2021 : 12:21:40 PM
Change:

sys.exit(app.exec())


To:

app.exec()


I just helped someone with this last week and that was the solution.


Thanks,
Chris Drozdowski
Originlab Technical Support

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000