当前位置: 首页 > news >正文

《开始使用PyQT》 第01章 PyQT入门 03 用户界面介绍

03 用户界面介绍

《开始使用PyQT》 第01章 PyQT入门 03 用户界面介绍

The user interface (UI) has become a key part of our everyday lives, becoming the intermediary between us and our ever-growing number of machines. A UI is designed to facilitate in human-computer interaction. The human needs to operate and control the machine to serve some purpose; meanwhile, the machine needs to simultaneously provide feedback and a means to interact with it in order to aid the human’s decisionmaking process. UIs are everywhere, from the mobile applications on our phones to web browsers, to heavy machinery controls, and even on the appliances in our kitchens. Of course, the ways in which we interact with technology is not merely limited to our hands, as many UIs also allow interaction with our other sensory organs.

用户界面(UI)已成为我们日常生活的重要组成部分,成为我们与日益增多的机器之间的中介。用户界面旨在促进人机交互。人类需要操作和控制机器,以达到某种目的;与此同时,机器需要同时提供反馈和与之互动的方式,以帮助人类做出决策。用户界面无处不在,从我们手机上的移动应用程序到网页浏览器,再到重型机械控制装置,甚至是我们厨房里的电器。当然,我们与技术互动的方式不仅仅局限于我们的双手,许多用户界面还可以与我们的其他感觉器官进行互动。

A good UI is tasked with helping a person produce a desired result while also allowing for easier, more efficient, and more friendly operation of a machine. Think about the photo editing apps on your phone. Editing the size, color, or exposure is practically effortless as you slide your fingers across the screen and watch the images change almost instantly. The user provides minimal input to achieve the desired output.

一个好的用户界面的任务是帮助用户获得理想的结果,同时还能让用户更轻松、更高效、更友好地操作机器。想想你手机上的照片编辑应用程序。编辑尺寸、颜色或曝光几乎不费吹灰之力,手指在屏幕上滑动,图像几乎瞬间就会发生变化。用户只需提供最少的输入,就能实现所需的输出。

什么是图形化用户界面?

For this book, we will be focusing on creating desktop graphical user interfaces (GUI) that take advantage of a computer’s graphics capabilities to create visual applications. Decades ago, users would have to use the command line and text commands to interact with the computer. Tasks such as opening, deleting and moving files, and searching through directories were all done by typing in certain commands. However, these were not very user-friendly or simple-to-use interfaces for the general public. So GUIs were created to allow users to interact with electronic devices using graphical controls, rather than command-line interfaces.

本书的重点是创建桌面图形用户界面(GUI),利用计算机的图形功能创建可视化应用程序。几十年前,用户必须使用命令行和文本命令与计算机交互。打开、删除和移动文件以及搜索目录等任务都是通过输入特定命令来完成的。然而,对于普通大众来说,这些界面并不是非常友好或简单易用。因此,图形用户界面应运而生,允许用户使用图形控制而不是命令行界面与电子设备进行交互。

These graphical control elements, or widgets, such as buttons, menus, and windows, make such tasks effortless. Interaction now becomes as simple as moving your mouse or touching the screen depending upon your device and clicking on the widget.

按钮、菜单和窗口等这些图形控制元素或小工具让这些任务变得毫不费力。现在,交互变得非常简单,只需移动鼠标或触摸屏幕(视设备而定),然后点击部件即可。

创建良好界面设计的理念

This, first and foremost, is a technical book written to help those of you who want to learn how to create and code your own GUI with PyQt and Python. That being said, if you plan to design any kind of UI that other people will use, then you are no longer creating a UI just to solve your own problems. You must also begin to consider other users of the application as well. Think about what you want them to accomplish, or how the application can help them. Sometimes, when we are trying to solve a problem, we get so caught up in trying to create a product that we forget about the people who actually have to interact with them.

首先,这是一本技术书籍,旨在帮助那些想学习如何使用 PyQt 和 Python 创建和编写自己的图形用户界面的人。尽管如此,如果您打算设计任何类型的用户界面供他人使用,那么您就不再只是为了解决自己的问题而创建用户界面。您还必须开始考虑应用程序的其他用户。想想你想让他们完成什么,或者应用程序能如何帮助他们。有时,当我们试图解决一个问题时,我们会过于专注于创造一个产品,而忘记了真正需要与之交互的人。

The following is a list of concepts to consider when designing your own UI. They are not set rules and by no means a complete list, but rather ideas that you should consider when designing your own applications.

以下是在设计自己的用户界面时需要考虑的一些概念。它们不是固定的规则,也绝不是完整的列表,而是您在设计自己的应用程序时应该考虑的想法。

Clarity – Using clear language, hierarchy, and flow with visualelements to avoid ambiguity. One of the ways this can be achieved is by considering visual importance to the human eye, laying out widgets with bigger sizes, darker colors, etc., in such a manner that we can visually understand the UI.

清晰度–使用清晰的语言、层次结构和视觉元素流程,避免含糊不清。实现这一点的方法之一是考虑视觉对人眼的重要性,用更大的尺寸、更深的颜色等布局部件,使我们能直观地理解用户界面。

Conciseness – Simplifying the layout to include only what the userneeds to see or interact with at a given time in order to be brief,but also comprehensive. Adding more labels or buttons in yourwindow just to give the user more options is not always better.

简洁–简化布局,只包含用户在特定时间内需要查看或交互的内容,这样既简洁又全面。在窗口中添加更多标签或按钮,只是为了给用户提供更多选择,并不总是更好的做法。

Consistency – Design the UI so that there is consistency across theapplication. This helps users to recognize patterns in the visualelements and layout and can be seen in typography that improvesthe navigation and readability of the application, image styles, oreven color schemes.

一致性–设计用户界面时要确保整个应用程序的一致性。这有助于用户识别视觉元素和布局中的模式,可体现在提高应用程序导航和可读性的排版、图像样式甚至配色方案中。

Efficiency – Utilizing good design and shortcuts to help the userimprove productivity. If a task can be accomplished in two steps,why design your GUI so that the work has to be completed in five?

效率 - 利用良好的设计和快捷方式帮助用户提高工作效率。如果一项任务只需两步就能完成,为什么还要设计图形用户界面,让用户在五步内完成工作呢?

Familiarity – Consider elements that users normally see inother UIs and how they would expect them to perform in yourapplications. For example, think about how weird it would be to have to enter your login information, only to find the password entry field is above the username. It is not wrong, but now you are unnecessarily making users think about their actions and slowing them down.

熟悉性–考虑用户通常在其他用户界面中看到的元素,以及他们希望这些元素在你的应用程序中如何执行。例如,如果要输入登录信息,却发现密码输入字段在用户名的上方,想想会有多奇怪。这并没有错,但现在您却不必要地让用户思考他们的操作,从而减慢了他们的速度。

Responsive – Give the user feedback, for example, a toggle thatchanges color to “on” or “off,” a small message to notify the user iftheir input is correct or incorrect, or even a sound effect to verify acompleted action. The user should never be left wondering if theiraction was successful or not.

响应式 - 给用户反馈,例如,将颜色切换为 "开 "或 "关 "的切换按钮、通知用户输入正确或错误的小信息,甚至是验证操作是否完成的声音效果。用户不应该怀疑自己的操作是否成功。

相关文章:

《开始使用PyQT》 第01章 PyQT入门 03 用户界面介绍

03 用户界面介绍 《开始使用PyQT》 第01章 PyQT入门 03 用户界面介绍 The user interface (UI) has become a key part of our everyday lives, becoming the intermediary between us and our ever-growing number of machines. A UI is designed to facilitate in human-co…...

HTML-列表

列表 abbr&#xff1a; li : list item ol : orderd list ul : unordered list dl : definition list dt : definition title dd : definition description 1.有序列表(order list) 概念&#xff1a;有顺序或侧重顺序的列表 <h2>要把大象放冰箱总共分几步</h2> &…...

OceanBase创建租户

租户是集群之上的递进概念&#xff0c;OceanBase 数据库采用了多租户架构。 集群偏部署层面的物理概念&#xff0c;是 Zone 和节点的集合&#xff0c;租户则偏向于资源层面的逻辑概念&#xff0c;是在物理节点上划分的资源单元&#xff0c;可以指定其资源规格&#xff0c;包括…...

Java中Integer(127)==Integer(127)为True,Integer(128)==Integer(128)却为False,这是为什么?

文章目录 1.前言2. 源码解析3.总结 1.前言 相信大家职业生涯中或多或少的碰到过Java比较变态的笔试题&#xff0c;下面这道题目大家应该不陌生&#xff1a; Integer i 127; Integer j 127;Integer m 128; Integer n 128;System.out.println(i j); // 输出为 true System.o…...

【Unity】粒子贴图异常白边问题

从PS制作的黑底&#xff0c;白光的贴图。放入Unity粒子中&#xff0c;拉远看会有很严重的白边&#xff0c;像马赛克一样。 材质使用&#xff1a;Mobile/Particles/Additive 经测试只使用一张黑色的图片&#xff0c;也会有白边。 解决方案&#xff1a; 关闭黑色底&#xf…...

bxCAN接收处理

接收处理 为了接收 CAN 消息&#xff0c;提供了构成 FIFO(First Input First Output) 的三个邮箱。为了节约 CPU 负载&#xff0c;简化软件并保证数据一致性&#xff0c;FIFO 完全由硬件进行管理。应用程序通过 FIFO 输出邮箱访问 FIFO 中所存储的消息。 有效消息 当消息依据…...

前端面试题-(浏览器内核,CSS选择器优先级,盒子模型,CSS硬件加速,CSS扩展)

前端面试题-(浏览器内核&#xff0c;CSS选择器优先级&#xff0c;盒子模型&#xff0c;CSS硬件加速&#xff0c;CSS扩展&#xff09; 常见的浏览器内核CSS选择器优先级盒子模型CSS硬件加速CSS扩展 常见的浏览器内核 内核描述Trident(IE内核)主要用在window系统中的IE浏览器中&…...

WEB前端标签的使用

图片标签 <!DOCTYPE html> <html><head><meta charset"utf-8"><title></title></head><body><!-- img标签就是用来将图片显示在页面上的标签 --><img src"图片路径"><!-- 可用路径&#…...

739. 每日温度

提示给定一个整数数组 temperatures &#xff0c;表示每天的温度&#xff0c;返回一个数组 answer &#xff0c;其中 answer[i] 是指对于第 i 天&#xff0c;下一个更高温度出现在几天后。如果气温在这之后都不会升高&#xff0c;请在该位置用 0 来代替。 示例 1: 输入: tempe…...

stm32F103C8T6简介及标准库和HAL库的区别

什么是单片机 单片机是一种集成电路芯片&#xff0c;把具有数据处理能力的中央处理器CPU、随机存储器RAM、只读存储器ROM、多种I/O和中断系统、定时器/计数器等功能&#xff08;可能还包括显示驱动电路、脉宽调制电路、模拟多路转换电路、A\D转换器等电路&#xff09;集成到一…...

操作系统(3)---操作系统引导

在安装操作系统后&#xff0c;磁盘的分布如下&#xff1a; C盘是这个磁盘的活动分区&#xff08;又称主分区&#xff09;&#xff0c;安装了操作系统 开机过程如下&#xff1a; 1.计算机的主存由RAM和ROM组成&#xff0c;RAM关机数据消失&#xff0c;而ROM&#xff08;Basic In…...

Vue3+Ts:实现paypal按钮

Vue3Ts&#xff1a;实现paypal按钮 一、前端页面按钮实现第一步&#xff1a;下载paypal.js依赖第二步&#xff1a;引入要使用的vue页面&#xff0c;并调用。 二、实现逻辑研究第一点&#xff1a;了解下Buttons自带的style属性第二点&#xff1a;了解下Buttons自带的处理方法第三…...

.[Decipher@mailfence.com].faust 勒索病毒数据怎么处理|数据解密恢复

尊敬的读者&#xff1a; 随着网络技术的发展&#xff0c;勒索病毒已经成为数字时代中一种极具破坏性的威胁。[support2022cock.li].faust [tsai.shenmailfence.com].faust [Encrypteddmailfence.com].faust[Deciphermailfence.com].faust 勒索病毒是其中的一种&#xff0c;它以…...

【UE Niagara】制作星光飘落效果

效果 步骤 1. 新建一个Niagara系统 选择模板“Fountain” 这里命名为“NS_Flare” 打开“NS_Flare”&#xff0c;选中Sprite渲染器&#xff0c;设置材质为上一篇文章中&#xff08;【UE 材质】闪烁的星星材质&#xff09;制作的材质“M_Flare” 2. 由于要在Niagara中调整粒子的…...

SLAM初学

昨天组长布置了任务&#xff0c;要求看香港大学的一篇论文&#xff0c;一打开&#xff0c;好家伙&#xff0c;纯英文&#xff0c;直接翻译着看 几个读不懂的概念&#xff1a; 体素&#xff1a;体素是三维空间中的体积像素的简称。它类似于二维图像中的像素&#xff0c;但在三…...

腾讯云轻量应用服务器Docker如何一键搭建属于自己的幻兽帕鲁服务器?

幻兽帕鲁/Palworld是一款2024年Pocketpair开发的开放世界生存制作游戏&#xff0c;在帕鲁的世界&#xff0c;玩家可以选择与神奇的生物“帕鲁”一同享受悠闲的生活&#xff0c;也可以投身于与偷猎者进行生死搏斗的冒险。而帕鲁可以进行战斗、繁殖、协助玩家做农活&#xff0c;也…...

win10+elasticsearch8.12 安装教程

Elasticsearch是一种搜索引擎&#xff0c;本地安装完成之后&#xff0c;可使用其他编程语言&#xff08;例如python&#xff09;与elasticsearch建立连接&#xff0c;然后使用python脚本搜索elasticsearch中的数据 1下载 elasticsearch elasticsearch最新版官网下载链接 点击…...

经典面试题-死锁

目录 1.什么是死锁&#xff1f; 2.形成死锁的四个必要条件 3.死锁的三种情况 第一种情况&#xff1a; 举例&#xff1a; 举例&#xff1a; 第二种情况&#xff1a;两个线程 两把锁 举例&#xff1a; 第三种情况&#xff1a;N个线程 M把锁 哲学家进餐问题 1.什么是死锁&…...

mysql面试题合集-基础

前言 工作很忙&#xff0c;本质还是自己比较懒惰&#xff0c;很久没更新博客了。近期打算面试&#xff0c;换个工作环境&#xff0c;那就先从面试题开始吧&#xff0c;后续也会逐渐更新自己在工作中的一些经验感悟。接下来切入主题&#xff0c;由于长期做前台开发工作&#xf…...

点灯大师(STM32)

这段代码是用于STM32F10x系列微控制器的C语言程序&#xff0c;目的是初始化GPIOC的Pin 13为输出&#xff0c;并设置其输出高电平。以下是对代码的逐行解释&#xff1a; #include "stm32f10x.h" 这一行引入了STM32F10x设备的头文件&#xff0c;包含了用于STM32F10x系…...

装饰模式(Decorator Pattern)重构java邮件发奖系统实战

前言 现在我们有个如下的需求&#xff0c;设计一个邮件发奖的小系统&#xff0c; 需求 1.数据验证 → 2. 敏感信息加密 → 3. 日志记录 → 4. 实际发送邮件 装饰器模式&#xff08;Decorator Pattern&#xff09;允许向一个现有的对象添加新的功能&#xff0c;同时又不改变其…...

椭圆曲线密码学(ECC)

一、ECC算法概述 椭圆曲线密码学&#xff08;Elliptic Curve Cryptography&#xff09;是基于椭圆曲线数学理论的公钥密码系统&#xff0c;由Neal Koblitz和Victor Miller在1985年独立提出。相比RSA&#xff0c;ECC在相同安全强度下密钥更短&#xff08;256位ECC ≈ 3072位RSA…...

JavaScript 中的 ES|QL:利用 Apache Arrow 工具

作者&#xff1a;来自 Elastic Jeffrey Rengifo 学习如何将 ES|QL 与 JavaScript 的 Apache Arrow 客户端工具一起使用。 想获得 Elastic 认证吗&#xff1f;了解下一期 Elasticsearch Engineer 培训的时间吧&#xff01; Elasticsearch 拥有众多新功能&#xff0c;助你为自己…...

AtCoder 第409​场初级竞赛 A~E题解

A Conflict 【题目链接】 原题链接&#xff1a;A - Conflict 【考点】 枚举 【题目大意】 找到是否有两人都想要的物品。 【解析】 遍历两端字符串&#xff0c;只有在同时为 o 时输出 Yes 并结束程序&#xff0c;否则输出 No。 【难度】 GESP三级 【代码参考】 #i…...

关于 WASM:1. WASM 基础原理

一、WASM 简介 1.1 WebAssembly 是什么&#xff1f; WebAssembly&#xff08;WASM&#xff09; 是一种能在现代浏览器中高效运行的二进制指令格式&#xff0c;它不是传统的编程语言&#xff0c;而是一种 低级字节码格式&#xff0c;可由高级语言&#xff08;如 C、C、Rust&am…...

C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。

1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj&#xff0c;再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...

分布式增量爬虫实现方案

之前我们在讨论的是分布式爬虫如何实现增量爬取。增量爬虫的目标是只爬取新产生或发生变化的页面&#xff0c;避免重复抓取&#xff0c;以节省资源和时间。 在分布式环境下&#xff0c;增量爬虫的实现需要考虑多个爬虫节点之间的协调和去重。 另一种思路&#xff1a;将增量判…...

python报错No module named ‘tensorflow.keras‘

是由于不同版本的tensorflow下的keras所在的路径不同&#xff0c;结合所安装的tensorflow的目录结构修改from语句即可。 原语句&#xff1a; from tensorflow.keras.layers import Conv1D, MaxPooling1D, LSTM, Dense 修改后&#xff1a; from tensorflow.python.keras.lay…...

高效线程安全的单例模式:Python 中的懒加载与自定义初始化参数

高效线程安全的单例模式:Python 中的懒加载与自定义初始化参数 在软件开发中,单例模式(Singleton Pattern)是一种常见的设计模式,确保一个类仅有一个实例,并提供一个全局访问点。在多线程环境下,实现单例模式时需要注意线程安全问题,以防止多个线程同时创建实例,导致…...

C++.OpenGL (20/64)混合(Blending)

混合(Blending) 透明效果核心原理 #mermaid-svg-SWG0UzVfJms7Sm3e {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-SWG0UzVfJms7Sm3e .error-icon{fill:#552222;}#mermaid-svg-SWG0UzVfJms7Sm3e .error-text{fill…...