banterbot.gui package

banterbot.gui.tk_interface module

class banterbot.gui.tk_interface.TKInterface(model: OpenAIModel | None = None, voice: AzureNeuralVoiceProfile | None = None, languages: str | list[str] | None = None, tone_model: OpenAIModel | None = None, system: str | None = None, phrase_list: list[str] | None = None, assistant_name: str | None = None)[source]

Bases: Tk, Interface

A graphical user interface (GUI) class that enables interaction with the BanterBot chatbot in a multiplayer mode. It supports functionalities such as text input, text-to-speech and speech-to-text capabilities for up to 9 users simultaneously, based on OpenAI and Azure services.

This class inherits from tkinter’s Tk class and a custom Interface class, allowing it to be displayed as a standalone window and follow a specific chatbot interaction protocol respectively.

listener_activate(idx: int) None[source]

Activate the speech-to-text listener.

Parameters:

name (Optional[str]) – The name of the user sending the message. Defaults to None.

listener_deactivate() None[source]

Deactivate the speech-to-text listener.

request_response() None[source]
reset_focus() None[source]
run(greet: bool = False) None[source]

Run the BanterBot application. This method starts the main event loop of the tkinter application.

Parameters:

greet (bool) – If True, greets the user unprompted on initialization.

select_all_on_focus(event) None[source]
update_conversation_area(word: str) None[source]

Update the conversation area with the specified word, and add the word to the chat log. This method should be implemented by subclasses to handle updating the specific GUI components.

Parameters:

word (str) – The word to add to the conversation area.

update_name(idx: int) None[source]