First time here? Check out the FAQ!
1

Running Textual Apps in a specific Terminal
 

Hi,

Is there a way to specify to run a Python script in a separate terminal application, such as iTerm2 on Mac or Windows Terminal on Windows?

I am developing multiple applications in the Textual package (https://textual.textualize.io/) and you can't run them in the Wingware IDE. Technically, the code runs, but you won't see the actual TUI at all. Instead, you get control and junk characters in the Debug I/O tab.

Here's an example piece of code:

import rich.spinner
from textual.app import App, ComposeResult
from textual.widgets import Static


class WidgetSpinner(Static):
    def on_mount(self):
        self.spinner = rich.spinner.Spinner("dots", text="working...")
        self.interval_update = self.set_interval(
            1 / 60, lambda: self.update(self.spinner)
        )


class ExampleApp(App):
    def compose(self) -> ComposeResult:
        yield WidgetSpinner()


if __name__ == "__main__":
    ExampleApp().run()

If you run this in a terminal yourself, you will see a spinner. If you run it in Wing, you don't get the output, which is kind of what I expected, but I don't know how to launch it in a process properly.

If you could give me some pointers, that would be great.

Thanks!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
driscollis's avatar
11
driscollis
asked Mar 7

Comments

see more comments

1 Answer

0

Use Configure External Console in the Options menu of the Debug I/O Tool or configure the external console setting on the Debugger > I/O page in the Preferences dialog. On macOS, the Terminal app is supported via a small AppleScript file and this possibly could be adapted for other terminal / console applications. On Windows, a native console window is used.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.2k
Wingware Support
answered Mar 8
link

Comments

see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)