Python Forum
Python GUI layout off between different OS
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python GUI layout off between different OS
#1
I am working on a program to call a GUI I designed in PyQt5 Designer.

The gui looks exactly as I designed it in Windows 10, but on Linux or Mac the design is off. Like the buttons are moved, the textboxes are out of the groupboxes etc. Is there something I need to do to get it to be fixed for all OS types?

Just basic code to call the .ui file for now. see code below and screenshots.

Any help is appreciated...

           

import os
import os.path
import sys
import subprocess
import serial.tools.list_ports
import xml.etree.ElementTree as ET
import platform

from PyQt5 import QtCore, QtGui, QtWidgets, QtSerialPort, uic
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from os import path

LOCAL_DIR = os.path.dirname(os.path.realpath(__file__)) + "/"


class Main(QtWidgets.QMainWindow):

    def __init__(self):

        super().__init__()

        self.ui = uic.loadUi(LOCAL_DIR + "ooeygui.ui", self)

        self.show()

    def _getosplatform(self):
        global osplat, dsep
        osplat = platform.system()
        if osplat == "Windows":
            dsep = "/"
        if osplat == "Linux":
            dsep = "/"
        if osplat == "Darwin":
            dsep = "/"
            osplat = "OS X"

        print(osplat)


if __name__ == '__main__':
    app = QtWidgets.QApplication([])
    gui = Main()
    gui._getosplatform()
    gui.show()
    sys.exit(app.exec_())
SHIFT838
http://shift838.99er.net

Telnet BBS:
fusionbbs.ddns.net:9640
Reply


Messages In This Thread
Python GUI layout off between different OS - by shift838 - Dec-30-2018, 04:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pyqt5 layout Nickd12 8 6,810 Jan-18-2021, 09:09 AM
Last Post: Axel_Erfurt
  PyQt5: Add Variable Number of Rows to Layout Based on Python Dictionary kennybassett 2 5,894 Oct-02-2018, 02:05 PM
Last Post: Alfalfa
  Button click doesnt work from my second class/layout in Python imamideb 0 2,975 Feb-13-2018, 12:09 PM
Last Post: imamideb
  [Tkinter] grid layout neech 8 20,851 Oct-14-2016, 07:06 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020