Skip to content

historybox_EN

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

historybox - History Log Box

[img]

In the end, I decided to create a history box with a DDLC menu style.

dokibox.historybox()
Parameter Type Default Description
data None, str, or other types "" A string to be parsed as history records. In most cases, it is automatically passed from dialogbox or diaenterbox.
pinned bool True Whether the history box is pinned to the top.

historybox is generally not called directly by users. It is most commonly used internally by dialogbox or diaenterbox.

Three Cases for data

  1. data is an empty string or not provided: Imports the history list from dokibox.dialogbox._history.
  2. data is a string: Creates a single history record as [("", data)], where the first element is an empty string (indicating no sender name, i.e. narration) and the second element is the message content.
  3. data is any other type: Uses it directly as records. The expected format is a list or tuple of (name, message) pairs.

Example of the third case:

records = [
    ("Monika", "Welcome to the Literature Club!"),
    ("Sayori", "The weather is so nice today!"),
    ("Yuri", "I'm reading a very interesting book..."),
    ("Natsuki", "Baka! It's not like I'm a tsundere or anything!"),
]

dokibox.historybox(records)

addhistory() Function {#addhistoryen}

Since dokibox is a GUI library, dialogue history currently exists only in memory.

addhistory() is used to preload existing dialogue history into memory, allowing previously recorded conversations to appear in the history box.

Usage

A list of tuples:

dokibox.addhistory([
    ("Monika", "Hello"),
    ("Sayori", "Hi there!")
])

A list of dictionaries:

dokibox.addhistory([
    {"name": "Yuri", "msg": "Hello, everyone!"}
])

A JSON string:

import json

dokibox.addhistory(
    json.dumps(
        [{"name": "Natsuki", "msg": "Hmph!"}],
        ensure_ascii=False
    )
)

Clone this wiki locally