There isn't a clear specific reason for posting the following text, but at least I want to thank you zentara for your useful posts and all readers;
moreover, my small experience with Tk could benefits from any type of comment to this post and moreover... the discussion could be useful to others...
So, Due to my No experience with Tk I don't know if there is a better way to accomplish my work, anyway my code is very confusing so I only briefly explain its scheme and I'll be pleased to receive any feedback on what the reader think about it and if he knows a simpler/better way:
1. The program Starts and load threads module (one thread only for all "Worker" functions, Tk run in the main (not threaded))
2. Define some shared vars used to manage Input from GUI, Output from "Worker thread" and state of "Worker thread"
3. Launch the "Worker Thread" (when it starts, it loads some settings and enter an infinite loop timed by select, at each cycle it checks a shared variable which give the ID of function to launch}
4. Open a Block { where loads Tk Module; whole Tk GUI resides here }
5. Each Time the user Launch a function, FUNC_CTRL subroutine (placed in the GUI Block) run and create the List of smaller functions needed and defined in "Worker thread"; so manage that "Stack" and opening/closure of MsgBox, Dialog Box, Refresh of the right Tk fields
6. Some shared variables filled by the "Worker" and reelaborated by different subroutines for each function to give out the right form of output in the right place (GUI Fields).
The Timers problem I think to have fixed, comes from inside the FUNC_CTRL fuction that manages the $MW->repeat object for each MsgBox, refresh etc, from creation to destruction, so it needs to know when they are up and runnig before free the "Worker Function", I did that this way:
my ($MSGBOX) = &MSG_WIN(); # Create the MsgBox Object and the repeat t
+imer inside which $STATE_of_MSGBOX_TIMER is changed. Return the MsgBo
+x object
$MW->waitVariable(\$STATE_of_MSGBOX_TIMER); # This should wait until M
+essage Box Timer is started
I created one thread only because starting a new one each time for each function show me the grow of used memory, and "detach()" or "join()" the thread doesn't free the memory, so it accumulates.