DEV Community

Cover image for From TS to Python :/

Posted on • Updated on

From TS to Python :/

I wanted to try python (lets call it "py"), cause it is very popular so I told myself to create something, that will be useful 4 me and not taking like weeks of work.

I came with countdown application, cause it make sense right for programmer to in some way just set some work time frame πŸ˜‰

I have asked chatGpt (will call ti Chat) how such draft would look like so to have some skeleton. That was nice to get familiar with python language, but I have also read some other stuff previously πŸ˜‰

But after that I decided to make a little brainstorming so I stared from scratch and used Chat only for like asking and learning.
Here comes the fun.

Like somebody once said about py, you either love it or hate it and I agree. From strictly typed TS to not typed py is a little bit crazy.

  • Indentation
  • No need to specify return type
  • No need or possibility to specify props types

Now I understand why this is like favourite language between students or people who don't want to bother with strictly typed languages like Java, C#, TS etc.

Anyway, I started with like this steps

  1. Do method to provide countdown with fixed values in terminal, just to see something πŸ˜€
  2. Create some UI to see it visually
  3. Add buttons to start, stop and pause
  4. Add functions for these buttons
  5. Add inputs for minutes and seconds
  6. Lastly make countdown app take these values and delete hardcoded ones

Chat is great for this type of tasks, cause py has good bunch of libraries that you can import nearly for everything, almost .. so after couple of hours split in few days the app was born. Yes, there were some bugs so I also had to find them but nothing serious, mainly steps order, local variables or something missing in logic but with chat it is much faster if you know what you want how it should behave. And if you mainly ask explanation if you don't understand all code that is for me one of the most important parts working with chat. (I guess not everybody does this right 😐

application preview

application preview

App is on top of all screens or windows, so you can move it everywhere you want, you can put there what ever time you want, there is also validation so you can pass only positive numbers. You can even build it with PyInstaller so that there is finally executable file and with adding it some alias (I am on linux) you just write e.g. countdown and it runs.

Then only thing I was not able to do are unit tests, cause it had some problems with thinker lib and main thread running for window so after two hours of trying, googling and asking chat, I resigned from this. But, who never fails, never can go higher right πŸš€

So in last words, do I love it or do I hate it? well, if I would not care about such strict rules like Java or C# has and if I would get used to indentation then I would probably love it. BUT now, I take it as nice to have language so play with but who knows .... mind change

Thanks for reading

UPDATE: 21.2.2024

I have updated my countdown so that it shows also some stats. I will try to make some video about this small app so looking forward..

updated countdown app

Top comments (0)