0

This is what it looks like now.

I need no space between the lines. Code:

from PyQt6.QtWidgets import *

from PyQt6 import QtCore, QtGui
from PyQt6.QtGui import *
from PyQt6.QtCore import *
import sys

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

        self.setWindowTitle("UDP File Transfer")
        
        self.setMinimumSize(400, 400)
        self.setMaximumSize(600, 600)
        
        grid = QGridLayout()
        
        recv_label = QLabel("Recv: ")
        send_label = QLabel("Send: ")
        recv_edit = QLineEdit()
        send_edit = QLineEdit()
        
        grid.addWidget(recv_label, 1, 0)
        grid.addWidget(recv_edit , 1, 1)
        grid.addWidget(send_label, 2, 0)
        grid.addWidget(send_edit , 2, 1)

        self.setLayout(grid)
        

app = QApplication(sys.argv)

window = Window()
window.show()

app.exec()

I can't figure out the indentation in Qt.

I tried to read the documentation and see examples.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Penguin
  • 101
  • 7
  • Either use the `alignment` argument for `addWidget()`, or set a row stretch for rows `0` and `3`. Note that, coincidentally, you are already using rows `1` and `2`, and in a normal situation you should have used `0` and `1` instead: the "cells" of a grid layout are placeholders, they don't represent physical sizes or ratios, unless the stretch/minimum size functions are explicitly used. – musicamante Mar 04 '23 at 18:59

0 Answers0