0% found this document useful (0 votes)
5 views2 pages

Main Window Py 2

This document outlines a PyQt5 application called 'NVivo Clone' that creates a main window with a welcome label and a toolbar. The toolbar includes actions for creating a new project and opening a file, with placeholder functionality for each action. The application is set up to display messages when these actions are triggered, although the actual project creation feature is not yet implemented.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Main Window Py 2

This document outlines a PyQt5 application called 'NVivo Clone' that creates a main window with a welcome label and a toolbar. The toolbar includes actions for creating a new project and opening a file, with placeholder functionality for each action. The application is set up to display messages when these actions are triggered, although the actual project creation feature is not yet implemented.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

from PyQt5.

QtWidgets import (

QMainWindow, QLabel, QToolBar, QAction, QFileDialog, QMessageBox

from PyQt5.QtGui import QIcon

from PyQt5.QtCore import QSize

class MainWindow(QMainWindow):

def __init__(self):

super().__init__()

self.setWindowTitle("NVivo Clone")

self.setGeometry(100, 100, 1000, 700)

label = QLabel("Welcome to NVivo Clone", self)

label.move(40, 80)

self.create_toolbar()

def create_toolbar(self):

toolbar = QToolBar("Main Toolbar")

toolbar.setIconSize(QSize(24, 24))

self.addToolBar(toolbar)

# Add New Project action

new_action = QAction(QIcon(), "New Project", self)

new_action.triggered.connect(self.new_project)

toolbar.addAction(new_action)
# Add Open File action

open_action = QAction(QIcon(), "Open File", self)

open_action.triggered.connect(self.open_file)

toolbar.addAction(open_action)

def new_project(self):

QMessageBox.information(self, "New Project", "New project creation not


implemented yet.")

def open_file(self):

file_path, _ = QFileDialog.getOpenFileName(self, "Open File", "", "Text


Files (*.txt);;All Files (*)")

if file_path:

QMessageBox.information(self, "File Selected", f"You selected:\


n{file_path}")

You might also like