Created
May 4, 2023 15:12
-
-
Save lllama/ba9fff44b3494aebad59084bf8a709b4 to your computer and use it in GitHub Desktop.
Tailwind introduces lag
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
import asyncio | |
from textual import * | |
from textual.app import * | |
from textual.widgets import * | |
class WorkerTest(App): | |
CSS = """ | |
Screen { | |
layout: grid; | |
grid-size: 4; | |
padding-top: 2; | |
padding-left: 2; | |
} | |
""" | |
def compose(self): | |
yield Button("Press me", id="runner") | |
with TabbedContent("one", "two", "three"): | |
yield Button("one") | |
yield Button("two") | |
yield Button("three") | |
@on(Button.Pressed, "#runner") | |
async def got_pressed(self, event): | |
self.log("The button got pressed") | |
self.run_tailwind() | |
@work | |
async def run_tailwind(self): | |
process = await asyncio.subprocess.create_subprocess_exec( | |
*["./tailwindcss", "-w"], | |
stdout=asyncio.subprocess.DEVNULL, | |
stderr=asyncio.subprocess.DEVNULL, | |
) | |
if __name__ == "__main__": | |
WorkerTest().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment