-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile(IO)
More file actions
41 lines (31 loc) · 1.07 KB
/
File(IO)
File metadata and controls
41 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
QPixmap, QRadialGradient)
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtWidgets import *
import sys, os
class Ui_main(QWidget):
def __init__(self):
super().__init__()
self.main_ui()
def main_ui(self):
self.setWindowTitle("Text Editor")
self.wr = QTextEdit()
self.b1 = QPushButton()
self.b1.setText("Save")
self.vbox = QVBoxLayout()
self.vbox.addWidget(self.wr)
self.vbox.addWidget(self.b1)
self.setLayout(self.vbox)
self.show()
self.b1.clicked.connect(self.saveit)
def saveit(self):
self.wr1 = self.wr.toPlainText()
f = open("FileSave.txt","w")
f.write(self.wr1)
self.close()
app = QApplication(sys.argv)
main = Ui_main()
sys.exit(app.exec_())