【发布时间】:2022-01-27 19:12:37
【问题描述】:
如何制作这样的用户界面
我尝试过代码和设计器,但我做不到
谢谢。
【问题讨论】:
-
请提供足够的代码,以便其他人更好地理解或重现问题。
标签: python pyqt5 qt-designer
如何制作这样的用户界面
我尝试过代码和设计器,但我做不到
谢谢。
【问题讨论】:
标签: python pyqt5 qt-designer
我能够通过在 qt 设计器中拖放来创建相同的布局 这是带有布局管理器的 UI 代码,并且能够调整停靠点的大小
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Frame</class>
<widget class="QFrame" name="Frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>628</width>
<height>604</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QDockWidget" name="dockWidget">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<widget class="QWidget" name="dockWidgetContents"/>
</widget>
<widget class="QDockWidget" name="dockWidget_2">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(32, 74, 135);</string>
</property>
<widget class="QWidget" name="dockWidgetContents_2"/>
</widget>
</widget>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<widget class="QDockWidget" name="dockWidget_4">
<property name="minimumSize">
<size>
<width>120</width>
<height>581</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(239, 41, 41);</string>
</property>
<widget class="QWidget" name="dockWidgetContents_4"/>
</widget>
<widget class="QDockWidget" name="dockWidget_3">
<property name="minimumSize">
<size>
<width>120</width>
<height>581</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(115, 210, 22);</string>
</property>
<widget class="QWidget" name="dockWidgetContents_3"/>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
将其保存到文件后,您可以通过运行将其更改为 py 文件
pyuic5 -x file.ui -o file.py
或者像cmets中musicamante所说的那样直接和uic模块一起使用
【讨论】:
uic模块即可。