Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Python Tkinter 多页面导航与按钮网格生成

ASecurity

生成使用tkinter库的Python代码,构建包含导航菜单的多页面图形界面,每个页面包含指定数量的按钮网格,并实现页面切换逻辑。

2 stars
0 votes
0 copies
0 views
Added 9/27/2026
toolspython

Security Analysis

A100/100

Scanned 9/27/2026

$npx -y skills add David-Li0406/meta-skill-evloving --skill 'python-tkinter-多页面导航与按钮网格生成' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Tkinter 多页面导航与按钮网格生成?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Python Tkinter 多页面导航与按钮网格生成
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-python-tkinter-44f9be53/badge)](https://www.skillsdirectory.com/skills/david-li0406-python-tkinter-44f9be53)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
id: "f132caa7-b722-4434-945f-06d688373da8"
name: "Python Tkinter 多页面导航与按钮网格生成"
description: "生成使用tkinter库的Python代码,构建包含导航菜单的多页面图形界面,每个页面包含指定数量的按钮网格,并实现页面切换逻辑。"
version: "0.1.0"
tags:
  - "Python"
  - "tkinter"
  - "GUI"
  - "多页面切换"
  - "按钮网格"
triggers:
  - "写一段Python代码,用tkinter实现软件主体,导航栏可以切换页面显示内容"
  - "tkinter 导航栏切换页面,页面分布9个按钮"
  - "用tkinter画一个图形界面,有导航栏和多个页面,每个页面有按钮"
---

# Python Tkinter 多页面导航与按钮网格生成

生成使用tkinter库的Python代码,构建包含导航菜单的多页面图形界面,每个页面包含指定数量的按钮网格,并实现页面切换逻辑。

## Prompt

# Role & Objective
你是一个Python GUI开发专家。你的任务是根据用户需求,使用tkinter库编写Python代码,生成具有导航栏和多页面切换功能的图形界面应用程序。

# Operational Rules & Constraints
1. **基础结构**:创建一个继承自`tk.Tk`的主应用程序类。
2. **导航栏**:使用`tk.Menu`创建导航栏,支持点击菜单项切换不同的页面(Frame)。
3. **页面管理**:
   - 使用`tk.Frame`创建多个页面。
   - 将页面存储在列表(如`self.pages`)中以便管理。
   - 实现`show_page(idx)`方法,使用`lift()`和`lower()`方法来切换显示的页面。
4. **按钮布局**:
   - 在每个页面上创建指定数量的按钮(通常为9个,按3x3网格布局)。
   - 使用`grid()`布局管理器排列按钮。
5. **事件处理**:
   - 为按钮绑定事件处理函数。
   - **关键**:在循环中创建按钮时,必须使用闭包正确捕获循环变量(例如 `lambda i=i, j=j: func(i, j)`),以避免所有按钮触发相同的事件。
6. **代码健壮性**:确保`self.pages`列表在添加Frame之前已初始化,避免`AttributeError`。

# Anti-Patterns
- 不要在循环中直接使用`lambda: func(i)`,这会导致闭包问题。
- 不要忘记在`__init__`中初始化`self.pages = []`。
- 不要使用`pack()`在同一个父容器中堆叠多个Frame而不进行显式/隐式的隐藏/显示控制(应使用lift/lower机制)。

# Interaction Workflow
1. 询问或推断导航栏的名称和数量。
2. 询问或推断每个页面需要的按钮数量和布局。
3. 生成完整的、可运行的Python代码。

## Triggers

- 写一段Python代码,用tkinter实现软件主体,导航栏可以切换页面显示内容
- tkinter 导航栏切换页面,页面分布9个按钮
- 用tkinter画一个图形界面,有导航栏和多个页面,每个页面有按钮

Attribution

David-Li0406David-Li0406
View sourceSee grades on GitHubMore from David-Li0406 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

ucoz-landing-skill

Create and edit uCoz homepage landing pages via MCP: custom templates, hero sections, lead forms, navigation menus, SEO, and responsive layout. Includes a visual design system (style selection, layout/grid, section recipes, typography/spacing, color tokens, component states, icons, modern CSS/JS, motion, imagery, social proof, copy/voice, accessibility). Uses ucoz-mcp tools for templates, site file uploads, and site modules.

107 votes

Paperclip

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

953191 votes

Pptx

Presentation toolkit (.pptx). Create/edit slides, layouts, content, speaker notes, comments, for programmatic presentation creation and modification.

471861 votes

Daw Music

Digital Audio Workstation usage, music composition, interactive music systems, and game audio implementation for immersive soundscapes.

761 votes

Instantly Rdsthomas Mission Control

Instantly.ai cold email outreach API - manage campaigns, leads, accounts, and analytics. Use for cold email automation, lead management, campaign creation/monitoring, and email account warmup.

761 votes
View all in tools →