Python小试牛刀:GUI(图形界面)实现计算器UI界面(二)

news2025/9/13 18:13:53

上一篇:Python小试牛刀:GUI(图形界面)实现计算器UI界面(一)-CSDN博客

在上一篇文章中介绍了Python GUI常用的库,以及运用GUI标准库tkinter仅设计了计算器的UI界面。

而在本篇文章,我将进一步完善计算器UI界面,实现鼠标放在在组件上即刻改变背景颜色,离开还原背景颜色,以及按钮触发也会有同样的效果。

在下一篇文章,我将完全实现计算器的全部功能,关注我,敬请耐心等待!

运行结果

程序设计

"""
    计算器界面(二)
"""

# 通配符'*'
__all__ = ['main']


# 计算器UI设计
class CalculatorUI:

    import tkinter as tk
    from tkinter import font

    base = tk.Tk()              # 新建窗口
    base.title('计算器')         # 设置标题
    base.geometry("458x400")    # 设置窗口像素大小

    # 全局变量
    labelData1 = tk.StringVar()  # 标签数据
    labelData2 = tk.StringVar()  # 标签数据

    # 设置字体样式
    setChineseFont = font.Font(family='Arial', size=20, weight='bold')
    setFont = font.Font(family='Helvetica', size=12, weight='bold')

    # 初始化设置
    labelData1.set('1+2=3')
    labelData2.set('3')

    # 主框架
    mainFrame = tk.LabelFrame(base, text='标准', borderwidth=2, relief=tk.FLAT, font=setChineseFont)
    mainFrame.pack(expand=True)
    # 标签框架
    labelFrame = tk.Frame(mainFrame, borderwidth=2, relief=tk.GROOVE)
    labelFrame.grid(columnspan=4)

    # 标签
    showLabel = tk.Label(labelFrame, textvariable=labelData1, anchor='e', width=26, font=setChineseFont)
    showLabel.pack()
    tk.Label(labelFrame, textvariable=labelData2, anchor='e', width=26, font=setChineseFont).pack()

    # 删除按钮
    clear = tk.Button(mainFrame, text='C', width=10, height=2, font=setFont)
    clear.grid(row=1, column=0)
    # 退格按钮
    backSpace = tk.Button(mainFrame, text='<-', width=10, height=2, font=setFont)
    backSpace.grid(row=1, column=1)
    # 余数(百分号)
    remainder = tk.Button(mainFrame, text='%', width=10, height=2, font=setFont)
    remainder.grid(row=1, column=2)
    # 除号
    division = tk.Button(mainFrame, text='➗', width=10, height=2, font=setFont)
    division.grid(row=1, column=3)

    # 7
    seven = tk.Button(mainFrame, text='7', width=10, height=2, font=setFont)
    seven.grid(row=2, column=0)
    # 8
    eight = tk.Button(mainFrame, text='8', width=10, height=2, font=setFont)
    eight.grid(row=2, column=1)
    # 9
    nine = tk.Button(mainFrame, text='9', width=10, height=2, font=setFont)
    nine.grid(row=2, column=2)
    # 乘号
    multiplication = tk.Button(mainFrame, text='✖', width=10, height=2, font=setFont)
    multiplication.grid(row=2, column=3)

    # 4
    four = tk.Button(mainFrame, text='4', width=10, height=2, font=setFont)
    four.grid(row=3, column=0)
    # 5
    five = tk.Button(mainFrame, text='5', width=10, height=2, font=setFont)
    five.grid(row=3, column=1)
    # 6
    six = tk.Button(mainFrame, text='6', width=10, height=2, font=setFont)
    six.grid(row=3, column=2)
    # 减法
    subtraction = tk.Button(mainFrame, text='➖', width=10, height=2, font=setFont)
    subtraction.grid(row=3, column=3)

    # 1
    one = tk.Button(mainFrame, text='1', width=10, height=2, font=setFont)
    one.grid(row=4, column=0)
    # 2
    two = tk.Button(mainFrame, text='2', width=10, height=2, font=setFont)
    two.grid(row=4, column=1)
    # 3
    three = tk.Button(mainFrame, text='3', width=10, height=2, font=setFont)
    three.grid(row=4, column=2)
    # 加法
    addition = tk.Button(mainFrame, text='➕', width=10, height=2, font=setFont)
    addition.grid(row=4, column=3)

    # 括号
    brackets = tk.Button(mainFrame, text='(  )', width=10, height=2, font=setFont)
    brackets.grid(row=5, column=0)
    # 0
    zero = tk.Button(mainFrame, text='0', width=10, height=2, font=setFont)
    zero.grid(row=5, column=1)
    # 小数点.
    dit = tk.Button(mainFrame, text='.', width=10, height=2, font=setFont)
    dit.grid(row=5, column=2)
    # 等于
    equal = tk.Button(mainFrame, text='=', width=10, height=2, background='#00BFFF', font=setFont)
    equal.grid(row=5, column=3)

    # 空白填充
    tk.Label(mainFrame, height=3, width=1).grid(row=1, column=4)  # 行填充
    tk.Label(mainFrame, height=3, width=1).grid(row=2, column=4)
    tk.Label(mainFrame, height=3, width=1).grid(row=3, column=4)
    tk.Label(mainFrame, height=3, width=1).grid(row=4, column=4)
    tk.Label(mainFrame, height=3, width=1).grid(row=5, column=4)
    tk.Label(mainFrame, height=1, width=16).grid(row=6, column=1)  # 列填充
    tk.Label(mainFrame, height=1, width=16).grid(row=6, column=3)


# 初始化事件
def initUI(event):
    # 0-9
    UI.zero.config(background='#f0f0f0')        # 0
    UI.one.config(background='#f0f0f0')         # 1
    UI.two.config(background='#f0f0f0')         # 2
    UI.three.config(background='#f0f0f0')       # 3
    UI.four.config(background='#f0f0f0')        # 4
    UI.five.config(background='#f0f0f0')        # 5
    UI.six.config(background='#f0f0f0')         # 6
    UI.seven.config(background='#f0f0f0')       # 7
    UI.eight.config(background='#f0f0f0')       # 8
    UI.nine.config(background='#f0f0f0')        # 9
    # 特殊字符
    UI.clear.config(background='#f0f0f0')       # 删除
    UI.backSpace.config(background='#f0f0f0')   # 退格
    UI.remainder.config(background='#f0f0f0')   # 百分号/求余
    UI.division.config(background='#f0f0f0')    # 除号
    UI.multiplication.config(background='#f0f0f0')  # 乘号
    UI.subtraction.config(background='#f0f0f0')     # 减号
    UI.addition.config(background='#f0f0f0')        # 加号
    UI.equal.config(background='#00BFFF')           # 等于
    UI.brackets.config(background='#f0f0f0')        # 括号
    UI.dit.config(background='#f0f0f0')             # 小数点


# 鼠标在组件上的焦点事件
# 0-9
# 0
def zeroBackground(event):
    UI.zero.config(background='pink')
def zeroReleaseBackground(event):
    UI.zero.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.zero.config(state=tk.NORMAL, background='#f0f0f0')
    zeroEvent(event)
# 1
def oneBackground(event):
    UI.one.config(background='pink')
def oneReleaseBackground(event):
    UI.one.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.one.config(state=tk.NORMAL, background='#f0f0f0')
    oneEvent(event)
# 2
def twoBackground(event):
    UI.two.config(background='pink')
def twoReleaseBackground(event):
    UI.two.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.two.config(state=tk.NORMAL, background='#f0f0f0')
    twoEvent(event)
# 3
def threeBackground(event):
    UI.three.config(background='pink')
def threeReleaseBackground(event):
    UI.three.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.three.config(state=tk.NORMAL, background='#f0f0f0')
    threeEvent(event)
# 4
def fourBackground(event):
    UI.four.config(background='pink')
def fourReleaseBackground(event):
    UI.four.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.four.config(state=tk.NORMAL, background='#f0f0f0')
    fourEvent(event)
# 5
def fiveBackground(event):
    UI.five.config(background='pink')
def fiveReleaseBackground(event):
    UI.five.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.five.config(state=tk.NORMAL, background='#f0f0f0')
    fiveEvent(event)
# 6
def sixBackground(event):
    UI.six.config(background='pink')
def sixReleaseBackground(event):
    UI.six.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.six.config(state=tk.NORMAL, background='#f0f0f0')
    sixEvent(event)
# 7
def sevenBackground(event):
    UI.seven.config(background='pink')
def sevenReleaseBackground(event):
    UI.seven.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.seven.config(state=tk.NORMAL, background='#f0f0f0')
    sevenEvent(event)
# 8
def eightBackground(event):
    UI.eight.config(background='pink')
def eightReleaseBackground(event):
    UI.eight.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.eight.config(state=tk.NORMAL, background='#f0f0f0')
    eightEvent(event)
# 9
def nineBackground(event):
    UI.nine.config(background='pink')
def nineReleaseBackground(event):
    UI.nine.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.nine.config(state=tk.NORMAL, background='#f0f0f0')
    nineEvent(event)

# 特殊字符
# 删除
def clearBackground(event):
    UI.clear.config(background='pink')
def clearReleaseBackground(event):
    UI.clear.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.clear.config(state=tk.NORMAL, background='#f0f0f0')
    clearEvent(event)
# 退格
def backSpaceBackground(event):
    UI.backSpace.config(background='pink')
def backSpaceReleaseBackground(event):
    UI.backSpace.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.backSpace.config(state=tk.NORMAL, background='#f0f0f0')
    backSpaceEvent(event)
# 百分号/求余
def remainderBackground(event):
    UI.remainder.config(background='pink')
def remainderReleaseBackground(event):
    UI.remainder.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.remainder.config(state=tk.NORMAL, background='#f0f0f0')
    remainderEvent(event)
# 除号
def divisionBackground(event):
    UI.division.config(background='pink')
def divisionReleaseBackground(event):
    UI.division.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.division.config(state=tk.NORMAL, background='#f0f0f0')
    divisionEvent(event)
# 乘号
def multiplicationBackground(event):
    UI.multiplication.config(background='pink')
def multiplicationReleaseBackground(event):
    UI.multiplication.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.multiplication.config(state=tk.NORMAL, background='#f0f0f0')
    multiplicationEvent(event)
# 减号
def subtractionBackground(event):
    UI.subtraction.config(background='pink')
def subtractionReleaseBackground(event):
    UI.subtraction.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.subtraction.config(state=tk.NORMAL, background='#f0f0f0')
    subtractionEvent(event)
# 加号
def additionBackground(event):
    UI.addition.config(background='pink')
def additionReleaseBackground(event):
    UI.addition.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.addition.config(state=tk.NORMAL, background='#f0f0f0')
    additionEvent(event)
# 等于
def equalBackground(event):
    UI.equal.config(background='pink')
def equalReleaseBackground(event):
    UI.equal.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.equal.config(state=tk.NORMAL, background='#00BFFF')
    equalEvent(event)
# 括号
def bracketsBackground(event):
    UI.brackets.config(background='pink')
def bracketsReleaseBackground(event):
    UI.brackets.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.brackets.config(state=tk.NORMAL, background='#f0f0f0')
    bracketsEvent(event)
# 小数点
def ditBackground(event):
    UI.dit.config(background='pink')
def ditReleaseBackground(event):
    UI.dit.config(state=tk.DISABLED, background='pink')
    UI.base.update()
    time.sleep(0.1)
    UI.dit.config(state=tk.NORMAL, background='#f0f0f0')
    ditEvent(event)

# 组件背景颜色
def widgetColor():
    # 0-9
    UI.zero.bind('<Motion>', zeroBackground)        # 0
    UI.one.bind('<Motion>', oneBackground)          # 1
    UI.two.bind('<Motion>', twoBackground)          # 2
    UI.three.bind('<Motion>', threeBackground)      # 3
    UI.four.bind('<Motion>', fourBackground)        # 4
    UI.five.bind('<Motion>', fiveBackground)        # 5
    UI.six.bind('<Motion>', sixBackground)          # 6
    UI.seven.bind('<Motion>', sevenBackground)      # 7
    UI.eight.bind('<Motion>', eightBackground)      # 8
    UI.nine.bind('<Motion>', nineBackground)        # 9
    # 特殊字符
    UI.clear.bind('<Motion>', clearBackground)                      # 删除
    UI.backSpace.bind('<Motion>', backSpaceBackground)              # 退格
    UI.remainder.bind('<Motion>', remainderBackground)              # 百分号/求余
    UI.division.bind('<Motion>', divisionBackground)                # 除号
    UI.multiplication.bind('<Motion>', multiplicationBackground)    # 乘号
    UI.subtraction.bind('<Motion>', subtractionBackground)          # 减号
    UI.addition.bind('<Motion>', additionBackground)                # 加号
    UI.equal.bind('<Motion>', equalBackground)                      # 等于
    UI.brackets.bind('<Motion>', bracketsBackground)                # 括号
    UI.dit.bind('<Motion>', ditBackground)                          # 小数点

    # 初始化
    UI.base.bind('<Leave>', initUI)

    # 按钮按下
    UI.base.bind('<KeyPress-0>', zeroReleaseBackground)     # 0
    UI.zero.bind('<Button-1>', zeroEvent)
    UI.base.bind('<KeyPress-1>', oneReleaseBackground)      # 1
    UI.one.bind('<Button-1>', oneEvent)
    UI.base.bind('<KeyPress-2>', twoReleaseBackground)      # 2
    UI.two.bind('<Button-1>', twoEvent)
    UI.base.bind('<KeyPress-3>', threeReleaseBackground)    # 3
    UI.three.bind('<Button-1>', threeEvent)
    UI.base.bind('<KeyPress-4>', fourReleaseBackground)     # 4
    UI.four.bind('<Button-1>', fourEvent)
    UI.base.bind('<KeyPress-5>', fiveReleaseBackground)     # 5
    UI.five.bind('<Button-1>', fiveEvent)
    UI.base.bind('<KeyPress-6>', sixReleaseBackground)      # 6
    UI.six.bind('<Button-1>', sixEvent)
    UI.base.bind('<KeyPress-7>', sevenReleaseBackground)    # 7
    UI.seven.bind('<Button-1>', sevenEvent)
    UI.base.bind('<KeyPress-8>', eightReleaseBackground)    # 8
    UI.eight.bind('<Button-1>', eightEvent)
    UI.base.bind('<KeyPress-9>', nineReleaseBackground)     # 9
    UI.nine.bind('<Button-1>', nineEvent)

    UI.base.bind('<KeyPress-Delete>', clearReleaseBackground)    # 删除
    UI.base.bind('<KeyPress-c>', clearReleaseBackground)         # 删除
    UI.base.bind('<Key-C>', clearReleaseBackground)              # 删除
    UI.clear.bind('<Button-1>', clearEvent)
    UI.base.bind('<KeyPress-BackSpace>', backSpaceReleaseBackground)  # 退格
    UI.backSpace.bind('<Button-1>', backSpaceEvent)
    UI.base.bind('<Shift-Key-%>', remainderReleaseBackground)         # 百分号、求余
    UI.remainder.bind('<Button-1>', remainderEvent)
    UI.base.bind('<KeyPress-slash>', divisionReleaseBackground)       # 除号
    UI.division.bind('<Button-1>', divisionEvent)
    UI.base.bind('<KeyPress-asterisk>', multiplicationReleaseBackground)    # 乘号
    UI.base.bind('<Shift-Key-*>', multiplicationReleaseBackground)          # 乘号
    UI.multiplication.bind('<Button-1>', multiplicationEvent)
    UI.base.bind('<KeyPress-minus>', subtractionReleaseBackground)          # 减号
    UI.subtraction.bind('<Button-1>', subtractionEvent)
    UI.base.bind('<KeyPress-plus>', additionReleaseBackground)              # 加号
    UI.base.bind('<Shift-Key-+>', additionReleaseBackground)                # 加号
    UI.addition.bind('<Button-1>', additionEvent)
    UI.base.bind('<KeyPress-Return>', equalReleaseBackground)               # 等号
    UI.base.bind('<KeyPress-equal>', equalReleaseBackground)                # 等号
    UI.equal.bind('<Button-1>', equalEvent)
    UI.base.bind('<Shift-Key-(>', bracketsReleaseBackground)                # 左括号
    UI.base.bind('<Shift-Key-)>', bracketsReleaseBackground)                # 右括号
    UI.brackets.bind('<Button-1>', bracketsEvent)
    UI.base.bind('<KeyPress-period>', ditReleaseBackground)                 # 小数点
    UI.dit.bind('<Button-1>', ditEvent)


# 0 事件
def zeroEvent(event):
    UI.zero.config(activeforeground='gray')
    print(0)


# 1 事件
def oneEvent(event):
    UI.one.config(activeforeground='gray')
    print(1)


# 2 事件
def twoEvent(event):
    UI.two.config(activeforeground='gray')
    print(2)


# 3 事件
def threeEvent(event):
    UI.three.config(activeforeground='gray')
    print(3)


# 4 事件
def fourEvent(event):
    UI.four.config(activeforeground='gray')
    print(4)


# 5 事件
def fiveEvent(event):
    UI.five.config(activeforeground='gray')
    print(5)


# 6 事件
def sixEvent(event):
    UI.six.config(activeforeground='gray')
    print(6)


# 7 事件
def sevenEvent(event):
    UI.seven.config(activeforeground='gray')
    print(7)


# 8 事件
def eightEvent(event):
    UI.eight.config(activeforeground='gray')
    print(8)


# 9 事件
def nineEvent(event):
    UI.nine.config(activeforeground='gray')
    print(9)


# 删除 事件
def clearEvent(event):
    UI.clear.config(activeforeground='gray')
    print('clear')


# 退格 事件
def backSpaceEvent(event):
    UI.backSpace.config(activeforeground='gray')
    print('backspace')


# 求余 事件
def remainderEvent(event):
    UI.remainder.config(activeforeground='gray')
    print('remainder')


# 除法 事件
def divisionEvent(event):
    UI.division.config(activeforeground='gray')
    print('division')


# 乘法 事件
def multiplicationEvent(event):
    UI.multiplication.config(activeforeground='gray')
    print('multiplication')


# 减法 事件
def subtractionEvent(event):
    UI.subtraction.config(activeforeground='gray')
    print('subtraction')


# 加法 事件
def additionEvent(event):
    UI.addition.config(activeforeground='gray')
    print('addition')


# 等于 事件
def equalEvent(event):
    UI.equal.config(activeforeground='gray')
    print('equal')


# 括号 事件
def bracketsEvent(event):
    UI.brackets.config(activeforeground='gray')
    print('brackets')


# 小数点 事件
def ditEvent(event):
    UI.dit.config(activeforeground='gray')
    print('dit')



import tkinter as tk
import time
# 全局变量
UI = CalculatorUI()  # 计算器UI设计


# 主函数
def main():

    widgetColor()       # 组件背景颜色改变
    UI.base.mainloop()  # 保持窗口运行


# 代码测试
if __name__ == '__main__':
    main()
else:
    print(f'导入{__name__}模块')

作者:周华

创作日期:2023/11/1

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1159811.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

idea集成测试插件替代postman

idea集成测试插件替代postman 兄弟萌&#xff0c;你再测试接口是否无bug是否流畅的时候是否还在使用“postman”来回切换进行测试呢&#xff1f; 页面切换进行测试&#xff0c;有没有感觉很麻烦呢&#xff1f; 打开postman&#xff0c;输入接口地址&#xff0c;有没有感觉很麻烦…

如何选择云服务器?选择云服务器都要注意哪些关键点?

云服务器的选择对于企业和个人来说都是一个重要的决策&#xff0c;涉及到价格、周边生态、售后和续费等多个方面。本文将总结几个关键点&#xff0c;并推荐腾讯云作为一个性价比高、续费价格不贵的云服务器厂商。 价格&#xff1a;腾讯云的性价比高 在选择云服务器时&#xff…

自定义SpringBoot启动图标

在SpringBoot项目的resources目录下创建banner.txt文件 在https://www.bootschool.net/网站上复制Ascll艺术字&#xff08;图&#xff09;粘贴到banner.txt中保存。 启动项目就会加载 可以修改颜色&#xff0c;和版本号 ${application.version} 输出版本 ${spring-boot.v…

k8s-调度约束

目录 工作机制 调度过程 指定调度节点 Kubernetes 是通过 List-Watch 的机制进行每个组件的协作&#xff0c;保持数据同步的&#xff0c;每个组件之间的设计实现了解耦。 用户是通过 kubectl 根据配置文件&#xff0c;向 APIServer 发送命令&#xff0c;在 Node 节点上面…

土壤数据库辅助工具SPAW计算土壤导水率

土壤数据库辅助工具SPAW 首先下载SPAW工具 点击打开 根据之前的1比100土壤数据查表得到各个组分含量 其中 Field Capacity是田间持水量 Matric Bulk Density是基质粒密度 参考文章 【SWAT水文模型】ArcSWAT土壤数据库辅助工具SPAW简述

JavaEE就业课 V12.5 完整版

简介 众所周知&#xff0c;在IT互联网领域是靠技术吃饭的&#xff0c;更符合企业需求的先进技术才是硬通货。黑马Java学科一直在行动&#xff0c;一直走在行业最前沿! 四项目制用四个不同类型、不同开发深度的项目&#xff0c;去解决企业用人需求与学员具备相应开发能力匹配的…

ffmpeg命令帮助文档

一&#xff1a;帮助文档的命令格式 ffmpeg -h帮助的基本信息ffmpeg -h long帮助的高级信息ffmpeg -h full帮助的全部信息 ffmpeg的命令使用方式&#xff1a;ffmpeg [options] [[infile options] -i infile] [[outfile options] outfile] 二&#xff1a;将帮助文档输出到文件 …

【JAVA学习笔记】 57 - 本章作业

项目代码 https://github.com/yinhai1114/Java_Learning_Code/tree/main/IDEA_Chapter14/src/com/yinhai/homework 1. (1)封装个新闻类&#xff0c;包含标题和内容属性&#xff0c;提供get, set方法&#xff0c; 重写toString方法&#xff0c;打印对象时只打印标题; (2)只提供…

第四章 套接字通信

1.套接字socket 1. 概念 局域网和广域网 局域网&#xff1a;局域网将一定区域内的各种计算机、外部设备和数据库连接起来形成计算机通信的私有网络。广域网&#xff1a;又称广域网、外网、公网。是连接不同地区局域网或城域网计算机通信的远程公共网络。 IP&#xff08;Inter…

HTML、CSS和JavaScript,实现换肤效果的原理

这篇涉及到HTML DOM的节点类型、节点层级关系、DOM对象的继承关系、操作DOM节点和HTML元素 还用到HTML5的本地存储技术。 换肤效果的原理&#xff1a;是在选择某种皮肤样式之后&#xff0c;通过JavaScript脚本来加载选中的样式&#xff0c;再通过localStorage存储。 先来回忆…

5.4 完整性约束命名子句

思维导图: 笔记&#xff1a;5.4 完整性约束命名子句 定义: 完整性约束是在CREATE TABLE语句中定义的。SQL为CREATE TABLE语句提供了CONSTRAINT子句&#xff0c;用于对完整性约束进行命名。命名的目的是方便增加或删除约束。 基本结构: CONSTRAINT <完整性约束名称> &l…

泡泡玛特MOLLY携手支付宝蚂蚁庄园 深耕乡村儿童美育教育

近日&#xff0c;泡泡玛特旗下IP MOLLY携手支付宝蚂蚁庄园、中国乡村发展基金会共同发起“一笔一画&#xff0c;梦想成真”主题活动&#xff0c;主题活动在蚂蚁庄园平台开展&#xff0c;为泡泡玛特的人气IP MOLLY打造专属庄园&#xff0c;同时联合发布公益IP形象&#xff0c;公…

图像二值化阈值调整——cv2.threshold方法

二值化阈值调整&#xff1a;调整是指在进行图像二值化处理时&#xff0c;调整阈值的过程。阈值决定了将图像中的像素分为黑色和白色的界限&#xff0c;大于阈值的像素被设置为白色&#xff0c;小于等于阈值的像素被设置为黑色。 方法一&#xff1a; 取阈值为 127&#xff0c;…

Activiti7流程结束监听事件中,抛出的异常无法被spring全局异常捕捉

ProcessRuntimeEventListener activiti7中&#xff0c;提供了ProcessRuntimeEventListener监听器&#xff0c;用于监听流程实例的结束事件 /*** 流程完成监听器*/ Slf4j Component public class ProcessCompleteListener implements ProcessRuntimeEventListener<ProcessC…

可以直接在线制作电子画册的网站

​随着互联网技术的发展&#xff0c;越来越多的人开始使用在线工具来制作电子画册。今天&#xff0c;小编就来介绍一款可以直接在线制作电子画册的网站&#xff0c;让你的电子画册更加精美、个性化和实用。 1.首先点击FLBOOK在线制作制作电子杂志平台 2.点击开始制作&#xff0…

29岁从事功能测试5年被辞,面试4个月还没到工作......

最近一个32岁的老同学因为被公司辞退&#xff0c;聊天过程中找我倾诉&#xff0c;所以写下了这篇文章。 他是15年二本毕业&#xff0c;学的园林专业&#xff0c;人属于比较懒的那种&#xff0c;不爱学习&#xff0c;专业学的也一般。实习期间通过校招找到了一份对口的工作。但…

前端架构体系调研整理汇总

1.公司研发人数与前端体系 小型创业公司 前端人数&#xff1a; < 3 人 产品类型&#xff1a; 产品不是非常成熟&#xff0c;比较新颖。 项目流程&#xff1a;不完善&#xff0c;快、紧促&#xff0c;没有固定的时间排期。 技术栈&#xff1a; 没有历史包袱&#xff0c;技…

Http代理与socks5代理有何区别?如何选择?(二)

上篇文章我们基本分别了解了http代理与socks5代理的定义与优缺点&#xff0c;接下来我们继续来了解http代理与socks5代理之间的比较与区别。 一、两者的比较 1、功能比较 HTTP代理专门用于Web流量&#xff0c;并在处理HTTP和HTTPS协议方面非常高效。它们可以修改正在传输的数据…

清华大模型GLM

2022年,清华大学发布了一款具有重要意义的 GLM 大模型,它不仅在中文语言处理方面取得了显著的进展,还在英文语言处理方面表现出了强大的能力。GLM大模型区别于OpenAI GPT在线大模型只能通过API方式获取在线支持的窘境,GLM大模型属于开源大模型,可以本地部署进行行业微调、…

OSATE总线延迟的源码分析与模型修复——针对 Latency-case-study项目 端到端流延迟分析过程中空指针异常的解决

一、背景 在文章AADL 端到端流延迟分析示例项目 Latency-case-study 简述的 “第八章 进行系统的端到端流延迟分析” 中&#xff0c;遇到了这样的一个问题&#xff1a;对分布式系统的端到端流延迟进行分析时&#xff0c;没有生成流延迟分析报告&#xff0c;并且错误日志提示&am…