我的开发日志:随机数小程序

文章目录

前言

为什么我要设计这个程序呢?因为我要用,懒得在网上下载了,于是干脆写了一个。

UI设计

UI是我凹出来的,你们要使用,直接新建一个UI.ui文件,然后把下面的东西输进去就可以了。

ui 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>283</width>
    <height>365</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QLabel" name="label">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>10</y>
      <width>81</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>12</pointsize>
     </font>
    </property>
    <property name="text">
     <string>起始数字:</string>
    </property>
   </widget>
   <widget class="QSpinBox" name="SPstart">
    <property name="geometry">
     <rect>
      <x>130</x>
      <y>10</y>
      <width>131</width>
      <height>22</height>
     </rect>
    </property>
    <property name="minimum">
     <number>-999999999</number>
    </property>
    <property name="maximum">
     <number>999999999</number>
    </property>
   </widget>
   <widget class="QLabel" name="label_2">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>50</y>
      <width>81</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>12</pointsize>
     </font>
    </property>
    <property name="text">
     <string>结束数字:</string>
    </property>
   </widget>
   <widget class="QSpinBox" name="SPend">
    <property name="geometry">
     <rect>
      <x>130</x>
      <y>50</y>
      <width>131</width>
      <height>22</height>
     </rect>
    </property>
    <property name="minimum">
     <number>-999999999</number>
    </property>
    <property name="maximum">
     <number>999999999</number>
    </property>
   </widget>
   <widget class="QPushButton" name="Bstart">
    <property name="geometry">
     <rect>
      <x>50</x>
      <y>120</y>
      <width>81</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
     <string>生成</string>
    </property>
   </widget>
   <widget class="QTextBrowser" name="textN">
    <property name="geometry">
     <rect>
      <x>30</x>
      <y>170</y>
      <width>221</width>
      <height>101</height>
     </rect>
    </property>
   </widget>
   <widget class="QCheckBox" name="checkBox">
    <property name="geometry">
     <rect>
      <x>170</x>
      <y>130</y>
      <width>71</width>
      <height>16</height>
     </rect>
    </property>
    <property name="text">
     <string>去重</string>
    </property>
   </widget>
   <widget class="QPushButton" name="Bcopy">
    <property name="geometry">
     <rect>
      <x>100</x>
      <y>280</y>
      <width>81</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
     <string>复制</string>
    </property>
   </widget>
   <widget class="QSpinBox" name="SPquantity">
    <property name="geometry">
     <rect>
      <x>130</x>
      <y>90</y>
      <width>131</width>
      <height>22</height>
     </rect>
    </property>
    <property name="minimum">
     <number>-999999999</number>
    </property>
    <property name="maximum">
     <number>999999999</number>
    </property>
   </widget>
   <widget class="QLabel" name="label_3">
    <property name="geometry">
     <rect>
      <x>20</x>
      <y>90</y>
      <width>81</width>
      <height>21</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>12</pointsize>
     </font>
    </property>
    <property name="text">
     <string>生成数量:</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>283</width>
     <height>23</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
  <action name="action">
   <property name="text">
    <string>1</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>
</ui>

然后这个UI的效果应该是这样的:

代码

这玩意儿搞完了以后,就这样新建文件夹及文件:

新建完以后,就写基本框架了

相关推荐
小关会打代码12 分钟前
关于Pycharm中在运行出现语法错误:Non-UTF-8 code starting with
ide·python·pycharm
用户37215742613513 分钟前
Python 高效将 PDF 转换为 HTML 的实用指南
python
深栈14 分钟前
机器学习:编码方式
人工智能·python·机器学习·编码
yzx99101318 分钟前
Django 搭配数据库开发智慧园区系统全攻略
python·django·数据库开发
PixelMind27 分钟前
【LLIE技术专题】 SCI代码讲解
图像处理·python·低照度图像增强·llie
天才测试猿1 小时前
Python常用自动化测试框架—Pytest详解
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest
胡耀超1 小时前
2、CPU深度解析:从微架构到性能优化
python·性能优化·架构·arm·cpu·x86·多核心
en-route1 小时前
使用 Flask 构建 Web 应用:静态页面与动态 API 访问
前端·python·flask
ZeroNews内网穿透1 小时前
新版发布!“零讯”微信小程序版本更新
运维·服务器·网络·python·安全·微信小程序·小程序
hrrrrb3 小时前
【Python】文件处理(二)
开发语言·python