Skip to content

Text input lag with rapid keyboard input (barcode scanner) on macOS #2633

@sfrank10

Description

@sfrank10

Version of Dear PyGui

Version: 2.2
Operating System: macOs 26.3.1

My Issue/Question

When using a barcode scanner in an input_text field, the text populates visibly slower on version 2.2 than it did in previous versions. Setting vsync=False doesn't help. In DearPyGui 1.x (which used pre-1.87 Dear ImGui), characters appeared much faster.
Dear ImGui 1.87+ introduced io.ConfigInputTrickleEventQueue (default true), which spreads input events across multiple frames to prevent missed inputs at low framerates. However, this causes visible input lag when receiving rapid keyboard input — such as from a barcode scanner — because characters appear one-per-frame instead of all at once.

Workaround:
Setting ImGui::GetIO().ConfigInputTrickleEventQueue = false in mvViewport_apple.mm (after ImGuiIO& io = ImGui::GetIO()) resolves the issue.

Request:
Expose this as an option in configure_app(), e.g.:
dpg.configure_app(input_trickle_event_queue=False)

To Reproduce

Steps to reproduce the behavior:

  1. Create a simple app with an add_input_text field
  2. Use a USB barcode scanner (which sends rapid keystrokes) to scan into the field.

Expected behavior

I expect the text to populate quickly but instead it trickles in.

Screenshots/Video

https://github.com/user-attachments/assets/33ccb7f0-3580-47b5-b627-0c34509bea3c
https://github.com/user-attachments/assets/9e74a208-76e8-4ed5-a06e-de6e2d8a4ac1

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title="Barcode Input Test", width=600, height=200)
dpg.setup_dearpygui()

with dpg.window(label="Test", width=580, height=180):
    dpg.add_text("Scan a barcode into the field below:")
    dpg.add_input_text(label="Input", width=-1)

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions