0% found this document useful (0 votes)
36 views3 pages

2 Py

Uploaded by

abidi hassen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

2 Py

Uploaded by

abidi hassen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import sys

from [Link] import QApplication, QWidget, QLabel, QLineEdit, QPushButton,


QVBoxLayout, QFormLayout, QMessageBox, QDateEdit, QTextEdit, QTabWidget

class HospitalManagementApp(QWidget):
def __init__(self):
super().__init__()

self.init_ui()

def init_ui(self):
# Create widgets for patient registration
self.lbl_patient_name = QLabel('Patient Name:')
self.edit_patient_name = QLineEdit()

# ... (other patient registration fields)

self.btn_register_patient = QPushButton('Register Patient')


self.btn_register_patient.[Link](self.register_patient)

# Create layout for patient registration


patient_form_layout = QFormLayout()
patient_form_layout.addRow(self.lbl_patient_name, self.edit_patient_name)
# ... (add other patient registration fields)
patient_form_layout.addRow(self.btn_register_patient)

# Create widget for patient registration and set layout


patient_tab = QWidget()
patient_tab.setLayout(patient_form_layout)

# Create widgets for different visits


self.lbl_visit_purpose = QLabel('Visit Purpose:')
self.edit_visit_purpose = QLineEdit()

self.lbl_visit_date = QLabel('Visit Date:')


self.edit_visit_date = QDateEdit()

self.btn_schedule_visit = QPushButton('Schedule Visit')


self.btn_schedule_visit.[Link](self.schedule_visit)

# Create layout for different visits


visit_form_layout = QFormLayout()
visit_form_layout.addRow(self.lbl_visit_purpose, self.edit_visit_purpose)
visit_form_layout.addRow(self.lbl_visit_date, self.edit_visit_date)
visit_form_layout.addRow(self.btn_schedule_visit)

# Create widget for different visits and set layout


visit_tab = QWidget()
visit_tab.setLayout(visit_form_layout)

# Create tab widget and add patient registration and different visits tabs
tab_widget = QTabWidget()
tab_widget.addTab(patient_tab, 'Patient Registration')
tab_widget.addTab(visit_tab, 'Schedule Visit')

# Create a text area for displaying registered information


self.text_area = QTextEdit()

# Create a button to print information


self.btn_print_information = QPushButton('Print Information')
self.btn_print_information.[Link](self.print_information)

# Create main layout and add tab widget and print button
main_layout = QVBoxLayout()
main_layout.addWidget(tab_widget)
main_layout.addWidget(self.text_area)
main_layout.addWidget(self.btn_print_information)

# Set the layout for the main window


[Link](main_layout)

# Set window properties


[Link]('Hospital Management App')
[Link](100, 100, 500, 400)

# Show the window


[Link]()

def register_patient(self):
# Implement patient registration logic here
# ...

# For demonstration purposes, just print the information to the console


registration_info = f"Patient Name: {self.edit_patient_name.text()} (and
other fields)"
print(registration_info)

# Clear the patient registration form after registration


self.edit_patient_name.clear()
# ... (clear other patient registration fields)

# Update the text area with the registered information


self.text_area.append(registration_info)

def schedule_visit(self):
# Implement visit scheduling logic here
# ...

# For demonstration purposes, just print the information to the console


visit_info = f"Visit Purpose: {self.edit_visit_purpose.text()}, Visit Date:
{self.edit_visit_date.date().toString('yyyy-MM-dd')}"
print(visit_info)

# Clear the visit form after scheduling


self.edit_visit_purpose.clear()
self.edit_visit_date.clear()

# Update the text area with the scheduled visit information


self.text_area.append(visit_info)

def print_information(self):
# Implement print information logic here
# ...

# For demonstration purposes, just print the information to the console


print("Printing information:")
print(self.text_area.toPlainText())
if __name__ == '__main__':
app = QApplication([Link])
hospital_app = HospitalManagementApp()
[Link](app.exec_())

You might also like