Skip to content

dialogbox_bottombtn_EN

windows99-hue edited this page Jul 20, 2026 · 1 revision

Menu Buttons in dialogbox

Since dokibox v2.8.0, dialogbox has finally gained menu buttons similar to the original DDLC!

The History button opens historybox to display the conversation history. dokibox automatically records every dialog from the start of the program, and you can also add history entries manually via addhistory.

Menu Button Overview

A row of menu buttons is displayed at the bottom of dialogbox, from left to right:

Button Function Description
History Open history Invokes historybox to display dialog history
Skip Toggle skip mode When enabled, automatically advances through dialogs quickly; click again to cancel
Auto Toggle auto mode When enabled, dialogs advance automatically; click again to cancel
Save Execute save callback Requires savecall parameter; otherwise the button is disabled
Load Execute load callback Requires loadcall parameter; otherwise the button is disabled
Settings Execute settings callback Requires settingscall parameter; otherwise the button is disabled

History Feature

The History button opens the history box. dokibox automatically records every dialog from the start of the program.

Automatic Recording

Every time dialogbox() is called, the dialog content is automatically added to the history:

import dokibox

# These dialogs are automatically recorded
dokibox.dialogbox("Hello, world!", name="Monika")
dokibox.dialogbox("The weather is really nice today.", name="Sayori")

Manual Addition with addhistory()

You can also manually add history entries using addhistory():

import dokibox

# Method 1: List of tuples
dokibox.addhistory([
    ("Monika", "Welcome to the Literature Club!"),
    ("Sayori", "Do you have a new poem to share today?"),
])

# Method 2: List of dictionaries
dokibox.addhistory([
    {"name": "Yuri", "msg": "This book is truly fascinating..."},
    {"name": "Natsuki", "msg": "Hmph, I'd never admit that!"},
])

# Method 3: JSON string
dokibox.addhistory('[{"name": "Monika", "msg": "Everyone is wonderful!"}]')

Viewing History

Click the History button at the bottom of dialogbox to open the historybox window displaying all history entries.

Save/Load/Settings Callbacks

The Save, Load, and Settings buttons are disabled by default (grayed out and not clickable). You need to pass callback functions via parameters to enable them:

import dokibox

def on_save():
    print("Executing save logic...")
    # Implement save functionality here

def on_load():
    print("Executing load logic...")
    # Implement load functionality here

def on_settings():
    print("Opening settings...")
    # Implement settings functionality here

dokibox.dialogbox(
    "Welcome to my visual novel!",
    name="Monika",
    savecall=on_save,
    loadcall=on_load,
    settingscall=on_settings
)

Global Callback Settings

You can also set global callbacks for all dialogbox instances via global variables:

import dokibox

# Set global callbacks
dokibox.dialogbox.save = on_save
dokibox.dialogbox.load = on_load
dokibox.dialogbox.settings = on_settings

# All subsequent dialogbox calls will use these callbacks
dokibox.dialogbox("First dialog...", name="Sayori")
dokibox.dialogbox("Second dialog...", name="Yuri")

Note: Locally passed savecall/loadcall/settingscall parameters take precedence over global settings.

Skip and Auto Modes

Skip Mode

Click the Skip button to toggle skip mode:

  • When enabled, the button text is highlighted
  • Dialogs advance automatically at a very fast speed (approximately 100ms delay per line)
  • Click again to cancel skip mode
# In skip mode, typewriter effects are disabled
dokibox.dialogbox("This dialog will display quickly in skip mode", name="Monika")

Auto Mode

Click the Auto button to toggle auto mode:

  • When enabled, the button text is highlighted
  • Dialogs advance automatically after display completes (delay time is dynamically calculated based on text length)
  • Click again to cancel auto mode
# In auto mode, dialogs advance automatically
dokibox.dialogbox("First line", name="Sayori")
dokibox.dialogbox("The second line will appear automatically in a few seconds", name="Sayori")

Tip: Skip and Auto modes are mutually exclusive — enabling one will automatically disable the other.

Interaction Behavior

  • Click anywhere on the dialog box: If typewriter animation is in progress, the full text is displayed immediately; otherwise, the current dialog is dismissed
  • Click a menu button: Executes the corresponding function
  • Mouse hover: Menu buttons display a highlight effect
  • Keyboard ESC: Dismisses the current dialog

Complete Example

import dokibox

def setup_game():
    # Set global callbacks
    dokibox.dialogbox.save = lambda: print("Game saved!")
    dokibox.dialogbox.load = lambda: print("Game loaded!")
    dokibox.dialogbox.settings = lambda: print("Opening settings menu")
    
    # Add history entries
    dokibox.addhistory([
        ("Monika", "Welcome to the Literature Club!"),
        ("Sayori", "Want to write a poem together today?"),
    ])
    
    # Display dialog
    dokibox.dialogbox(
        "Hello, welcome to my visual novel world!\nYou can use the bottom menu to browse history, skip, or auto-play.",
        name="Monika",
        typewriter=True,
        chardelay=30
    )
    
    dokibox.dialogbox(
        "Try clicking the 'History' button to view previous dialogs.",
        name="Sayori"
    )

if __name__ == "__main__":
    setup_game()

Notes

  1. History limitations: History is stored in memory and will be lost when the program closes. For persistence, implement your own save logic.
  2. Callback blocking: If savecall/loadcall/settingscall contain time-consuming operations, consider using asynchronous execution to avoid blocking the UI.
  3. Menu button internationalization: Menu text automatically switches based on system language (supports Chinese, Japanese, and English).

Clone this wiki locally