File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 77- [ How can I select and copy text in a Textual app?] ( #how-can-i-select-and-copy-text-in-a-textual-app )
88- [ How can I set a translucent app background?] ( #how-can-i-set-a-translucent-app-background )
99- [ How do I center a widget in a screen?] ( #how-do-i-center-a-widget-in-a-screen )
10+ - [ How do I fixed WorkerDeclarationError?] ( #how-do-i-fixed-workerdeclarationerror )
1011- [ How do I pass arguments to an app?] ( #how-do-i-pass-arguments-to-an-app )
1112- [ Why do some key combinations never make it to my app?] ( #why-do-some-key-combinations-never-make-it-to-my-app )
1213- [ Why doesn't Textual look good on macOS?] ( #why-doesn't-textual-look-good-on-macos )
@@ -144,6 +145,29 @@ if __name__ == "__main__":
144145 ButtonApp().run()
145146```
146147
148+ <a name =" how-do-i-fixed-workerdeclarationerror " ></a >
149+ ## How do I fixed WorkerDeclarationError?
150+
151+ Textual version 0.31.0 requires that you set ` thread=True ` on the ` @work ` decorator if you want to run a threaded worker.
152+
153+ If you want a threaded worker, you would declare it in the following way:
154+
155+ ``` python
156+ @work (thread = True )
157+ def run_in_background ():
158+ ...
159+ ```
160+
161+ If you * don't* want a worker, you should make your work function ` async ` :
162+
163+ ``` python
164+ @work ():
165+ async def run_in_background ():
166+ ...
167+ ```
168+
169+ This change was made because it was easy to accidentally created a threaded worker, which may produce unexpected results.
170+
147171<a name =" how-do-i-pass-arguments-to-an-app " ></a >
148172## How do I pass arguments to an app?
149173
You can’t perform that action at this time.
0 commit comments