Я хочу видеть график целиком, без мотания, помогите пожалуйста
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QGraphicsScene, QGraphicsView
from PyQt5.QtGui import QPen, QPainter
from PyQt5.QtCore import Qt
class TestSequence(QGraphicsView):
def __init__(self, sequence):
super().__init__()
self.setWindowTitle("Test Sequence")
self.setGeometry(100, 100, 800, 600)
scene = QGraphicsScene(self)
self.setScene(scene)
pen = QPen(Qt.black)
pen.setWidth(2)
x, y = 0, 0
for bit in sequence:
if bit == '0':
scene.addLine(x, y, x + 20, y, pen)
x += 20
elif bit == '1':
scene.addLine(x, y, x, y - 20, pen)
y -= 20
def read_sequence(filename):
with open(filename, 'r') as file:
sequence = file.read().strip()
return sequence
if __name__ == '__main__':
app = QApplication(sys.argv)
sequence = read_sequence("last_bits.txt")
test_sequence = TestSequence(sequence)
test_sequence.show()
sys.exit(app.exec_())