PtolemyGUI/PyGUIQt6/PtolemyGUIPy.py

62 lines
1.6 KiB
Python
Raw Normal View History

2024-10-29 21:59:49 -04:00
#!/usr/bin/python3
import os
import datetime
import csv
import socket
import sys
import time
2024-10-29 22:53:17 -04:00
from functools import partial
from PyQt6.QtWidgets import QApplication, QMainWindow, QGridLayout, QPushButton, QComboBox, QWidget, QMenu, QTextEdit, QFileDialog
from PyQt6.QtCore import Qt, QPoint
from PyQt6.QtGui import QFont
2024-10-29 21:59:49 -04:00
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Ptolemy GUI")
2024-10-29 22:53:17 -04:00
self.setGeometry(100, 100, 1000, 700)
self.setMinimumSize(400, 600)
2024-10-29 21:59:49 -04:00
2024-10-29 22:53:17 -04:00
self.text_edit = QTextEdit()
self.text_edit.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap)
font = QFont("Courier New", 8) # You can adjust the size as needed
self.text_edit.setFont(font)
# self.text_edit.setFixedHeight(500)
try:
with open("../DWBA", 'r') as file:
content = file.read()
self.text_edit.setText(content)
except Exception as e:
self.text_edit.setText(f"Failed to load file:\n{e}")
# self.view_file_button = QPushButton("Help")
# self.view_file_button.clicked.connect(self.open_file_viewer)
2024-10-29 21:59:49 -04:00
self.cal_button = QPushButton("Calculate DWBA")
2024-10-29 22:53:17 -04:00
self.cal_button.clicked.connect(self.CalDWBA)
2024-10-29 21:59:49 -04:00
# Set up the layout
2024-10-29 22:53:17 -04:00
layout = QGridLayout()
layout.addWidget(self.cal_button, 0, 0)
layout.addWidget(self.text_edit, 0, 1, 5, 5)
2024-10-29 21:59:49 -04:00
# Set up the container and layout
container = QWidget()
container.setLayout(layout)
self.setCentralWidget(container)
2024-10-29 22:53:17 -04:00
def CalDWBA(self):
print("Number of Row ")
2024-10-29 21:59:49 -04:00
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MyWindow()
window.show()
sys.exit(app.exec())