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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Python
 pyqt5
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jy1u18@soton.ac.uk

United Kingdom
6 Posts

Posted - 06/17/2021 :  12:16:06 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic

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!!

Chris D

428 Posts

Posted - 06/17/2021 :  12:21:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

jy1u18@soton.ac.uk

United Kingdom
6 Posts

Posted - 06/19/2021 :  09:23:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000