Python ttkbootstrap 制作账户注册信息界面

Python GUI开发模块之ttkbootstrap使用详解 在Python的GUI开发中,使用Tkinter是一种常见的选择。 而ttkbootstrap模块则是在Tkinter的基础上提供了更加现代化和美观的界面设计风格,使得开发者可以快速构建出各种吸引人的GUI应用程序。 本文将对ttkbootstrap模块进行深入分析,并结合多种场景下的Python代码案例,展示其在实际开发中的应用。 阅读详情

前言

ttkbootstrap 是一个基于 tkinter 的界面美化库,使用这个工具可以开发出类似前端 bootstrap 风格的 tkinter 桌面程序。
ttkbootstrap 不仅有丰富的案例,同时还有完善的官方文档,可惜是英文的。不过对于程序员来说,只要用好翻译软件与提供的案例代码,一样可以轻松上手,那么接下来我们就介绍一下这个工具的使用。

准备工作

首先肯定是需要安装一下 ttkbootstrap

版本要新,最好不要用镜像源安装
pip install ttkbootstrap

PC端主页左侧可以领取【Python视频】、【PDF书籍】、【源码】,还可以帮忙疑难解答

可以先来个小案例试试手

import ttkbootstrap as ttk
from ttkbootstrap.constants import *

# root = tk.Tk()  # 使用 tkinter 创建窗口对象
root = ttk.Window()  # 使用 ttkbootstrap 创建窗口对象

root.geometry('300x150')

b1 = ttk.Button(root, text="按钮 1", bootstyle=SUCCESS)  # 使用 ttkbootstrap 的组件
b1.pack(side=LEFT, padx=5, pady=10)

b2 = ttk.Button(root, text="按钮 2", bootstyle=(INFO, OUTLINE))   # OUTLINE 是指定边框线
b2.pack(side=LEFT, padx=5, pady=10)

root.mainloop()

开始我们今天的案例教学

完整代码,复制运行即可(明示👍👍👍)

import ttkbootstrap as tk

root = tk.Window(themename='litera')
root.geometry('350x500+500+500')
root.title('萌新-注册页面')
root.wm_attributes('-topmost', 1)

username_str_var = tk.StringVar()
password_str_var = tk.StringVar()

# 0 女 1 男 -1 保密
gender_str_var = tk.IntVar()
# 兴趣爱好
hobby_list = [
    [tk.IntVar(), '吃'],
    [tk.IntVar(), '喝'],
    [tk.IntVar(), '玩'],
    [tk.IntVar(), '乐'],
]

# 账户信息
tk.Label(root, width=10).grid()
tk.Label(root, text='用户名:').grid(row=1, column=1, sticky=tk.W, pady=10)
tk.Entry(root, textvariable=username_str_var).grid(row=1, column=2, sticky=tk.W)
tk.Label(root, text='密  码:').grid(row=2, column=1, sticky=tk.W, pady=10)
tk.Entry(root, textvariable=password_str_var).grid(row=2, column=2, sticky=tk.W)

# 性别 单选框
tk.Label(
Tkinter的超强主题扩展-ttkbootstrap Tkinter 的超强主题扩展,可实现受 Bootstrap 启发的按需现代平面风格主题。如果你想学习接口自动化测试,我这边给你推荐一套视频,这个视频可以说是B站播放全网第一的接口自动化测试教程,同时在线人数到达1000人,并且还有笔记可以领取及各路大神技术交流:798478386【已更新】B站讲的最详细的Python接口自动化测试实战教程全集(实战最新版)_哔哩哔哩_bilibili。 阅读详情

相关推荐

汇总ttkbootstrap实用案例

还提供了一些样式和主题管理器,可以帮助你设计出符合现代化风格的界面。利用这些组件和布局管理器,你可以灵活地设计各种复杂的界面布局,满足不同的需求。提供了一些常用的布局组件和布局管理器,可以帮助你设计现代化的 Tkinter 界面。提供了一些常用的布局组件和布局管理器。除了上述的组件和布局管理器外,

克里斯蒂亚诺更新的博客 1658

Python ttkbootstrap 快速制作账户注册信息界面~

谁不想要一个美观的界面呢?

xff123456_的博客 1026

新手用Claude Code开发猜拳游戏:从AI生成到打包上线的全流程踩坑指南

AI编程工具如Claude Code正改变着软件开发的学习与实践方式,其核心原理是基于大语言模型的代码生成与补全能力。这项技术的价值在于能显著降低编程入门门槛,让开发者能更专注于逻辑设计与架构思考,而非语法细节。在实际应用场景中,它尤其适合快速原型验证、算法实现和编写工具脚本。本文以Python Tkinter开发图形界面猜拳游戏为例,深入剖析了从环境配置、需求描述、代码审查到UI美化、逻辑完善的全过程。针对API Key获取、网络环境配置、需求拆解技巧、边界条件处理等常见痛点,提供了具体解决方案。最后,还

weixin_33754065的博客 472

拆解特斯拉Optimus的关节技术:谐波减速器在仿人机器人中的5个精妙设计

本文深度解析特斯拉Optimus仿人机器人关节中的谐波减速器技术,揭示其五大工程突破:微型化材料革命、两万分之一圈精度实现、碳纤维柔轮轻量化、智能运维系统及国产替代方案。重点探讨谐波减速器如何通过创新设计和先进材料实现精准传动,为仿人机器人提供高效可靠的关节动力解决方案。

omega的博客 1077

亚马逊SP-API授权实战:从OAuth流程到Refresh Token获取

本文详细解析了亚马逊SP-API授权流程,从OAuth认证到Refresh Token获取的全过程。通过实战经验分享,帮助开发者快速掌握Marketplace Appstore、Website Workflow和自行授权三种方式,解决常见错误如MD5100和MD9999,并提供了安全存储Refresh Token的最佳实践。

weixin_30379531的博客 519

VLA、世界模型与端到端在智驾中的本质关系与工程落地

世界模型并非3D重建,而是对环境状态转移函数的可微分建模;VLA不是视觉+语言+动作的简单拼接,核心在于跨模态语义对齐。二者共同支撑具身智能系统实现从感知到行动的闭环推演,其技术价值体现在长尾场景泛化能力提升与决策延迟降低。在自动驾驶领域,真实量产方案均采用VLA架构作为多模态感知基础,嵌入轻量级世界模型以支持反事实轨迹推演,并通过WA硬件封装保障实时性,最终由端到端控制层完成像素到扭矩的语义贯通。这种混合架构已成L2+/L3智驾系统的工程共识。

weixin_34163553的博客 366

DeepSeek 在 PostgreSQL 中,执行 `DELETE` 操作后,数据占用的空间并不会立即释放给操作系统

操作后,数据占用的空间并不会立即释放给操作系统。这是 PostgreSQL 的 MVCC(多版本并发控制)机制决定的——删除的数据只是被标记为“死元组”,物理空间仍然被表占用。这是最彻底的释放方式,会将表重写为一个没有空洞的新文件,将空间返回给操作系统。如果你的表非常大(如几百GB),或者这是生产环境的核心表,建议优先考虑。你可以告诉我你的表大概多大、是否能接受锁表,我可以给你更精确的建议。要真正释放空间,需要根据你的实际需求,从以下三种方案中选择一种。如果你既想彻底释放空间,又无法接受锁表,

m0_37843156的博客 407

芯片原厂linux驱动开发的分享

大家好,我是XX,来自湖南XX学院,电子信息18级,也曾在创新基地控制组学习过两三年,毕业后就职于一家芯片原厂的解决方案部,担任驱动工程师的职位,算上实习期,我的工作时长已有两年。在此我想将这两年期间学习与积累到的一些经验输出出来,与大家一同分享。知识面有限,只能简单介绍一些驱动开发方向的一些经验,且由于经验尚浅,文中难免会有一些疏漏和错误之处,还请大家积极地批评指正。

嵌入式技术开发 853

Python爬虫实战:基于最新技术栈的政府招标采购数据抓取与分析

对于企业、研究人员和数据分析师来说,能够高效地获取这些数据意味着可以获得宝贵的商业洞察和市场先机。随着反爬技术的不断升级和网站结构的日益复杂,传统的爬虫方法已经难以满足需求。我们将采用Selenium、Playwright等现代浏览器自动化工具,结合Scrapy框架和异步请求库,构建一个能够应对各种反爬措施的强大爬虫系统。Playwright是微软开发的浏览器自动化工具,支持Chromium、WebKit和Firefox,比Selenium更快速、更稳定。

2201_76125261的博客 1313

Java开源海外跨境电商购物商城源码,TikToK商城系统源码,外贸商城在线交易

最近很火的一款商城源码,朋友分享给我的,完整版,java开源代码,带有非常详细的搭建教程,文件都一个多G,喜欢的可以下载来研究研究!3、创建mall 数据库并导入数据,数据库名用户名为:mall 数据库密码保持为:XXKytcACPX3GbdsH。8、进入cd /data/deploy/mall-tool/目录执行./build.sh脚本。7、宝塔ssh进入cd /data/deploy/mall/ 执行./build.sh脚本。2、安装宝塔环境:安装 Redis、MySQL5.7、Ngin1.2。

百创科技 2823

2017年全国大学生电子设计竞赛综合测评题目解析——Multisim仿真

1.题目 给定两个单电源的双运放芯片READ2302G芯片(当时记得增益带宽积好像是6M),一片HD74LS74数字芯片双D触发器,需要详细电路图、手写报告,5个波形输出,测频,测幅,8:00公布题目,15:00停止答题,中间可以吃饭(也可以不吃继续做),15:00清场,休息一段时间后开始进场测试,打分。 2.要求 (1)一片运放搭建方波振荡电路,频率 20 KHz,误差 0.1 KHz,幅度 3...

DengFengLai123的博客 2万+

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

上一篇: Pycharm快捷键大全
下一篇: Python实现考拉海购数据采集
终究不过路人
博客等级 码龄5年 125粉丝 9原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值