We don't bite newbies here... much | |
PerlMonks |
Tk mainloop placement in sequence of callsby gsd4me (Beadle) |
on Mar 31, 2018 at 19:07 UTC ( [id://1212084]=perlquestion: print w/replies, xml ) | Need Help?? |
gsd4me has asked for the wisdom of the Perl Monks concerning the following question: Dear all, This is probably a simple question but one that I have failed to get correct despite several attempts. I have a series of projects that I have developed to do some tasks on my laptop - no web or published modules involved. All the projects have some common areas - asking the user to specify an input file for example. So I have a module that contains all these common procedures as ... well... procedures that access globally common data. The problem I am having is the timing of the GUI aspects, interactions and actions that these procedures carry out. So I have a module that upon being called by each project, initialises some global variables and also creates a new MainWindow from the tK package. There is also a defined procedure that asks what file the user wishes to open as this is done at least once (if not more) by each project So in pseudo-code:
my Question is where do I need to place the MainLoop call for this sequence of events? after the initial main window creation or when I ask for the file or in each project's code? There are other GUI interactions required with the projects but if I can get a nice answer from this posting, then I can use that as a basis for everything else to get the sequence interaction correct. Note that each project *will* call myGlobalaskForFile more than once during its operation to get a subset of filenames required so the call to that procedure is not a 'once only' request. I have tried putting the mainLoop call in both these procedures but the sequence of events doesn't occur in the *correct* sequence that I wish - usually I get a blank widget after the globalInit call, I *do* get asked for the filename, but at times that I would regard as being *not* the right time but what I need to know is where *should* I putthe mainloop call to ensure that all is OK? I did read once somewhere that there should only ever be one and only one call to mainloop so putting it into "myGlobalaskForFile" seems to break that 'rule' but in my testing my code seems to work, albeit imperfectly due to the operational sequence of my code Thanks in advance ADB
Back to
Seekers of Perl Wisdom
|
|