我们在 python 中称更多按钮或三个点或三行是什么?

问题描述

例如,在 Windows Calculator 中,我们得到了三行按钮,也称为 more 按钮,所以我的问题是,如果我们想在 tkinter 中创建,它在 python 中的名称是什么。

enter image description here

正如你在图片中看到的三行,所以请帮助我。?

enter image description here

我将如何使窗格逐渐变慢。

解决方法

我制作了一个完整的导航栏。

截图:

Overview

Navbar

源代码:

from tkinter import PhotoImage
import tkinter as tk
from tkinter.messagebox import showinfo

# dictionary of colors:
color = {"nero": "#252726","orange": "#FF8700","darkorange": "#FE6101"}

# setting root window:
root = tk.Tk()
root.title("Tkinter Navbar")
root.config(bg="gray17")
root.geometry("400x600+850+50")

# setting switch state:
btnState = False

# loading Navbar icon image:
navIcon = PhotoImage(file="menu.png")
closeIcon = PhotoImage(file="close.png")

# setting switch function:
def switch():
    global btnState
    if btnState is True:
        # create animated Navbar closing:
        for x in range(301):
            navRoot.place(x=-x,y=0)
            topFrame.update()

        # resetting widget colors:
        brandLabel.config(bg="gray17",fg="green")
        homeLabel.config(bg=color["orange"])
        topFrame.config(bg=color["orange"])
        root.config(bg="gray17")

        # turning button OFF:
        btnState = False
    else:
        # make root dim:
        brandLabel.config(bg=color["nero"],fg="#5F5A33")
        homeLabel.config(bg=color["nero"])
        topFrame.config(bg=color["nero"])
        root.config(bg=color["nero"])

        # created animated Navbar opening:
        for x in range(-300,0):
            navRoot.place(x=x,y=0)
            topFrame.update()

        # turing button ON:
        btnState = True

# top Navigation bar:
topFrame = tk.Frame(root,bg=color["orange"])
topFrame.pack(side="top",fill=tk.X)

# Header label text:
homeLabel = tk.Label(topFrame,text="NS",font="Bahnschrift 15",bg=color["orange"],fg="gray17",height=2,padx=20)
homeLabel.pack(side="right")

# Main label text:
brandLabel = tk.Label(root,text="Naitik Singhal",font="System 30",bg="gray17",fg="green")
brandLabel.place(x=60,y=250)

# Navbar button:
navbarBtn = tk.Button(topFrame,image=navIcon,activebackground=color["orange"],bd=0,padx=20,command=switch)
navbarBtn.place(x=10,y=10)

# setting Navbar frame:
navRoot = tk.Frame(root,height=1000,width=300)
navRoot.place(x=-300,y=0)
tk.Label(navRoot,fg="black",width=300,padx=20).place(x=0,y=0)

# set y-coordinate of Navbar widgets:
y = 80
# option in the navbar:
options = ["Profile","Settings","Help","About","Feedback"]
# Navbar Option Buttons:
for i in range(5):
    tk.Button(navRoot,text=options[i],font="BahnschriftLight 15",fg=color["orange"],activebackground="gray17",activeforeground="green",command=lambda : showinfo("Info","It do something")).place(x=25,y=y)
    y += 40

# Navbar Close Button:
closeBtn = tk.Button(navRoot,image=closeIcon,command=switch)
closeBtn.place(x=250,y=6)

# window in mainloop:
root.mainloop()