Skip to content

Diff stat

Lines added and removed, with a row of green and red blocks, as in the git panel of a code editor.

ui.diff_stat · Category: Data · Full reference →

Diff statDiff stat
  • Next to a file, commit or pull request in a list of changes.
import pyzed as pz
from pyzed import ui
pz.column([
pz.row([ui.label("render.rs", mono=True), pz.hspace(), ui.diff_stat(42, 9)], align="center"),
pz.row([ui.label("app.py", mono=True), pz.hspace(), ui.diff_stat(3, 27)], align="center"),
pz.row([ui.label("README.md", mono=True), pz.hspace(), ui.diff_stat(12, 0)], align="center"),
], spacing=10, width=320)
Diff stat: Mostly addedDiff stat: Mostly added
Mostly added
Code
ui.diff_stat(42, 3)
Diff stat: Mostly removedDiff stat: Mostly removed
Mostly removed
Code
ui.diff_stat(2, 57)
Diff stat: Only addedDiff stat: Only added
Only added
Code
ui.diff_stat(12, 0)
Diff stat: blocks=10Diff stat: blocks=10
blocks=10
Code
ui.diff_stat(120, 40, blocks=10)

Diff stat has no events of its own: it shows what you give it. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.

diff_stat(added, removed, *, blocks=5, theme=None)

+12 −3 with GitHub-style colored blocks.

Property Default Description
added required Lines added.
removed required Lines removed.
blocks 5 Number of blocks.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →