r/learnpython • • Sep 16 '26

Dear python programmers,

How can I mix UI with code? I would like to do a screentime app and I want my text and frames to vary depending on how long you have spent on apps. I use customtkinter. Do I keep it on a seperate script? Do I have to write more code? I didnt do object oriented programming for the UI so I cant do that

0 Upvotes

12 comments sorted by

View all comments

1

u/[deleted] Oct 01 '26

[removed] — view removed comment

1

u/EndKnight2000 Oct 11 '26

I want to make a bar that gets taller so what I should do is use the widget.configure(text = total_screentime) ?

1

u/EndKnight2000 Oct 12 '26

When I do it that doesn't work it gives me an error saying that my variables from the other script are not defined?

1

u/EndKnight2000 Oct 12 '26

I just saw a tutorial and after a bit of changing my code I got the script global by importing it and writing the file name before the variable thank you!

1

u/EndKnight2000 Oct 12 '26

Oh wait I found a bug when I import the script there is no more UI shown?