-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4774 from Textualize/gradient-bar
Gradient progress bar
- Loading branch information
Showing
11 changed files
with
366 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.color import Gradient | ||
from textual.containers import Center, Middle | ||
from textual.widgets import ProgressBar | ||
|
||
|
||
class ProgressApp(App[None]): | ||
"""Progress bar with a rainbow gradient.""" | ||
|
||
def compose(self) -> ComposeResult: | ||
gradient = Gradient.from_colors( | ||
"#881177", | ||
"#aa3355", | ||
"#cc6666", | ||
"#ee9944", | ||
"#eedd00", | ||
"#99dd55", | ||
"#44dd88", | ||
"#22ccbb", | ||
"#00bbcc", | ||
"#0099cc", | ||
"#3366bb", | ||
"#663399", | ||
) | ||
with Center(): | ||
with Middle(): | ||
yield ProgressBar(total=100, gradient=gradient) | ||
|
||
def on_mount(self) -> None: | ||
self.query_one(ProgressBar).update(progress=70) | ||
|
||
|
||
if __name__ == "__main__": | ||
ProgressApp().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.