Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Addition to callbacks & custom UIs - Python

Offen
#279 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
45/100
Issue-Typ
Dokumentation
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
documentation

Rechercherichtung

Beginne mit der verlinkten Dokumentationsseite zu Callbacks und benutzerdefinierten UIs und sieh dir die umgebenden Beispiele an. Füge den gezeigten auf Python-Modulen basierenden Ansatz zum Speichern von UI-gesteuerten Werten neben den bestehenden Hinweisen zu global und nonlocal hinzu, wobei variables.py und main.py als Beispiel verwendet werden. Als erledigt gilt, wenn die Seite diese Alternative klar erklärt und das Beispiel mit der Callback-API konsistent ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

https://polyscope.run/py/features/callbacks_and_UIs/#creating-custom-uis

#If we want to use local variables & assign to them in the UI code below, 
# we need to mark them as nonlocal. This is because of how Python scoping 
# rules work, not anything particular about Polyscope or ImGui.
# Of course, you can also use any other kind of python variable as a controllable 
# value in the UI, such as a value from a dictionary, or a class member. Just be 
# sure to assign the result of the ImGui call to the value, as in the examples below.
# 
# If these variables are defined at the top level of a Python script file (i.e., not
# inside any method), you will need to use the `global` keyword instead of nonlocal`.

If you want to avoid using declarations global or nonlocal,
you can also use different module to store these values and call it on main module as below

variables.py
is_true: bool = False

main.py

import variables as vr

def callback()
        change, vr.is_true = psim.Checkbox("Selection box", vr.is_true)
Vorherrschende Sprache
C++
Sterne
2.2k
Forks
242
Ø Merge
11 Min.
Gemergte PRs (30 T.)
1

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nmwsharp/polyscope

Alle Issues in nmwsharp/polyscope

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.