I was practicing with PyQt5 and I realized that when I ran the same program in two different displays (monitor and laptop), the widgets appeared differently. I got an error in my command line but when I did this:
set QT_DEVICE_PIXEL_RATIO=0
set QT_AUTO_SCREEN_SCALE_FACTOR=1
set QT_SCREEN_SCALE_FACTORS=1
set QT_SCALE_FACTOR=1
python file_name.py
The error went away but the displays are still different.
When I run the program on monitor:
When I run the program on laptop:
Edit:
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *
import sys
def clicked():
print("clicked")
def window():
app = QApplication(sys.argv)
win = QMainWindow()
win.setGeometry(200, 200, 400, 400)
win.setWindowTitle("Tech with ")
central = QWidget()
win.setCentralWidget(central)
layout = QVBoxLayout(central)
label = QtWidgets.QLabel(win)
label.setText("my first label!")
layout.addWidget(label)
b1 = QtWidgets.QPushButton(win)
b1.setText("Click me!")
win.show()
sys.exit(app.exec_())
window()