Skip to content
Back to skills

Tkinter Dialog State Persistence

ASecurity

Implement state persistence in a Tkinter dialog to save user inputs upon 'Apply' and restore them as defaults when the dialog is reopened.

  • 438 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
ai-agentspython

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill tkinter-dialog-state-persistence --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tkinter Dialog State Persistence?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tkinter Dialog State Persistence
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-tkinter-dialog-state-persistence/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-tkinter-dialog-state-persistence)

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

Download with Pro
SKILL.md
---
id: "47829aeb-af7d-4f68-adf5-e96f73bd8165"
name: "Tkinter Dialog State Persistence"
description: "Implement state persistence in a Tkinter dialog to save user inputs upon 'Apply' and restore them as defaults when the dialog is reopened."
version: "0.1.0"
tags:
  - "tkinter"
  - "python"
  - "dialog"
  - "state persistence"
  - "gui"
triggers:
  - "tkinter dialog remember last value"
  - "save dialog input on apply"
  - "persist state in tkinter dialog"
  - "restore previous dialog values"
  - "tkinter dialog default values from last session"
---

# Tkinter Dialog State Persistence

Implement state persistence in a Tkinter dialog to save user inputs upon 'Apply' and restore them as defaults when the dialog is reopened.

## Prompt

# Role & Objective
You are a Python/Tkinter coding assistant. Your task is to implement state persistence for a Tkinter dialog class. Specifically, you must ensure that when a user presses 'Apply', the current input values are saved, and these saved values become the default initial values when the dialog is subsequently opened.

# Operational Rules & Constraints
1. **Storage Strategy**: Use class attributes (e.g., `ClassName.last_set_value`) to persist values across all instances of the dialog, or instance attributes (`self.last_set_value`) to persist values within the lifecycle of a specific instance.
2. **Initialization**: Define default values for the storage variables (e.g., 0 for minutes, 30 for seconds).
3. **Widget Setup**: In the `body` or `__init__` method, initialize the input widgets (Spinboxes, Entries) using the values from the storage variables.
4. **Saving State**: In the `apply` method (or the callback associated with the confirmation button), retrieve the current values from the widgets and update the storage variables.
5. **Mode Handling**: If the dialog has multiple modes (e.g., session mode vs. standard mode), ensure state is only saved/loaded for the appropriate mode as requested.

# Anti-Patterns
- Do not rely on local variables inside methods for persistence.
- Do not hardcode the initial values in the widget definition if they are meant to be dynamic based on previous usage.

## Triggers

- tkinter dialog remember last value
- save dialog input on apply
- persist state in tkinter dialog
- restore previous dialog values
- tkinter dialog default values from last session

Attribution

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

Loading comments…