I wrote the code as below. (I tried to create a program that opens a file with QFileDilaog and displays it in a Label.) But the program ended with "Process finished with exit code -1073740791 (0xC0000409)".
As far as I know, 0xC0000409 is a stack buffer overflow,
Why is this happening and how do I fix it?
import sys
import PyQt5
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
class QMainDialog(QDialog):
def __init__(self):
QDialog.__init__(self, None)
uic.loadUi(ui,self)
self.open.clicked.connect(self.Numclicked)
def Numclicked(self):
fname = QFileDialog.getOpenFileName(self)
pixmap = QPixmap(fname)
imagelabel.setPixmap(pixmap)
app = QApplication(sys.argv)
main_dialog = QMainDialog()
main_dialog.show()
app.exec_()
I use pycharm.
ui :
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1108</width>
<height>716</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPushButton" name="open">
<property name="geometry">
<rect>
<x>900</x>
<y>620</y>
<width>181</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>open</string>
</property>
</widget>
<widget class="QLabel" name="imagelabel">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>1061</width>
<height>581</height>
</rect>
</property>
<property name="text">
<string> image</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
User contributions licensed under CC BY-SA 3.0