Embedding IPython Qt console in a PyQt application

Ok, this code seems to do the trick (i.e. it puts a non-blocking ipython interpreter in a Qt widget, which can be embedded into other widgets). Keywords passed to terminal_widget get added to the namespace of the widget import atexit from IPython.zmq.ipkernel import IPKernelApp from IPython.lib.kernel import find_connection_file from IPython.frontend.qt.kernelmanager import QtKernelManager from IPython.frontend.qt.console.rich_ipython_widget import … Read more

Is there a difference between QFileDialog strings in PyQt4 and PyQt5?

The getOpenFileName function in PyQt4 returns a string that is the name of the selected file, and if none is selected then it returns an empty string. filename = QFileDialog.getOpenFileName(self, “Open Template”, “c:\\”, “Templates (*.xml);;All Files (*.*)”) However in PyQt5 this returns a tuple of 2 elements where the first one is a string that … Read more

PyQT: how to open new window

Here I’m using the show method. Here is a working example (derived from yours): #!/usr/bin/env python # -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore import sys class Second(QtGui.QMainWindow): def __init__(self, parent=None): super(Second, self).__init__(parent) class First(QtGui.QMainWindow): def __init__(self, parent=None): super(First, self).__init__(parent) self.pushButton = QtGui.QPushButton(“click me”) self.setCentralWidget(self.pushButton) self.pushButton.clicked.connect(self.on_pushButton_clicked) self.dialog = Second(self) def on_pushButton_clicked(self): self.dialog.show() def … Read more