hatamın ne olduğunu hala anlamadım. Benimkinden pek bi farkı yok gibi, bu fonksiyonu benimkine koyup self kısmını değiştirdim yinede olmuyor Process finished with exit code -1073740791 (0xC0000409) cıktısını alıyorum ve hangi dosyayı sectiysem o dosyanın türüne göre bir uygulamada acıyor mesela .txt dosyalarını not defteri ile acıyor.
from PyQt5.QtWidgets import QApplication
from gui import SimpleCodeGUI
from sys import exit, argv
if __name__ == '__main__':
app = QApplication(argv)
ex = SimpleCodeGUI()
exit(app.exec_())
gui.py:
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow, QSplitter
from editorFunctions import *
from menüBarManager import MenuBarManager
class SimpleCodeGUI(QMainWindow):
def __init__(self):
super().__init__()
self.menuBarManager = MenuBarManager(self)
self.initUI()
def initUI(self):
# Ana pencereyi oluştur
self.setWindowTitle('Simple Code')
self.setGeometry(100, 100, 600, 400)
fileMenu = self.menuBarManager.addMenu('File')
self.menuBarManager.addAction(fileMenu, 'Open File', lambda: EditorFileFunctions.openFile(self))
# Pencereyi göster
self.show()
menüBarManager.py:
from PyQt5.QtWidgets import QAction
class MenuBarManager:
def __init__(self, parent):
self.parent = parent
self.menubar = parent.menuBar()
def addMenu(self, title: str):
menu = self.menubar.addMenu(title)
return menu
def addAction(self, menu, title: str, action_func):
action = QAction(title, self.parent)
action.triggered.connect(action_func)
menu.addAction(action)
return action
editorFunctions.py:
from PyQt5.QtWidgets import QFileDialog
class EditorFileFunctions:
def newFile(window, tabPanel):
print("new file")
def openFile(window):
filename, _ = QFileDialog.getOpenFileName(window, "Open", ".", "Python Files (*.py)")
if filename:
with open(filename) as f:
print(f.read())
Sorun olmayan kısımları cıkarttığımda böyle kaliyor kod