Skip to content

Commit

Permalink
docs: modified quickstart simple example (#349)
Browse files Browse the repository at this point in the history
Co-authored-by: Talley Lambert <[email protected]>
  • Loading branch information
roynielsen17 and tlambert03 authored Jan 24, 2025
1 parent b49e834 commit 2179994
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ my_obj = MyObject()
# You (or others) can connect callbacks to your signals
@my_obj.value_changed.connect
def on_change(new_value: str):
print(f"The value changed to {new_value}!")

# The object may now emit signals when appropriate,
# (for example in a setter method)
my_obj.value_changed.emit('hi') # prints "The value changed to hi!"
print(f'Hi {new_value}!') # prints the new string - Hi {new_value}

# Mock event loop to see the effect of new signals with
# new values - watch the signal handler handle the changing values
count = 0
my_input = ""
while count < 5:
my_input = input("enter a name here: ")

# The object may now emit signals when appropriate,
# (for example in a setter method)
my_obj.value_changed.emit(str(my_input))
count = count + 1
```

Please see the [Basic Usage](usage.md) guide for an overview on how to use psygnal,
Expand Down

0 comments on commit 2179994

Please sign in to comment.