After the fundamental changes I've done to the programs main loop, it's time to fix the main function of the program, the new changes are added with easier fine tuning and adjust-ability as well as inclusion of additional functions to the program in mind.
- Interface elements overhaul
The interface elements such as labels that show the ping delays are now created at the start, this change allows the fine tuning their placement and text alignment that was not easily possible in the old code, with the new changes the program looks much better, but the changes are not just cosmetic, it goes hand to hand with the changes to the ping function to solve a major problem in the old code.
to simplify the process and easier changes in future, the labels are created inside two loops:
- The revamped ping function
The ping function now updates the pre-created labels text and color one by one cycling through them, in the old code each ping return was shown with a newly created label that was very taxing on the computers resources, the new code is much more compact and the memory overflow problem in long use sessions is solved.
since the position of each label is not calculated by each iteration of the ping, the variables holding the x and y position data are removed as well.
- The empty space
I reduced the number of labels that show on the screen to open up some space underneath, I have two use for this empty space in mind, show a bigger text with calculated average ping delay, or add buttons for additional functions I'm planning to add to the program, I know it's too early to ask, but your input on the matter would be appreciated.
In addition to the code changes, I added some instructions to the readme file and updated the executable file as well as adding the old version back just in case.
Posted on Utopian.io - Rewarding Open Source Contributors