in reply to Basic questions of Tk programming
the MainLoop as I understand it, takes the control of all events in your program, in a higher position, as Tk programs are event driven so I suppose ( WRONG supposition, see haj's reply)(and I'm bit surprised by your while 1 loop working ok) that when the MainLoop schedules events your while 1 loop falls into the category of idle events (to be confirmed) after windows, files and timers ones (in this order).
Infact when you realize that you are already inside an infinite loop seems weird to put in another one inside the main. General practice is to use Tk::after's after and repeat utilities.
About my $text_label ..I must admit I do not fully understand your sentence, but, for me you are declaring a variable and when you pack the MainLoop draws it on the screen, then you reuse the same variable to hold something else and you draw... it works but for me is misleading and bug prone. Just name 3 variables:
my $text_label_GREEN = $left_frame->Label->pack(... my $text_label_RED = $left_frame->Label->pack(... ..
L*
|
---|