in reply to Re^2: Tk::grid -sticky option not stretching frames
in thread Tk::grid -sticky option not stretching frames
In your example, I could replicate it with pack(), but it would involve alot of nested frames. When you move up to more advanced toolkits like Gtk2, Wx, etc. everything is done using packed vbox, hbox and table items. So, I generally give the advice to try and think in terms of using packing and tables.
Also I might add, that Tk::LabFrame is very useful in aligning.
|Replies are listed 'Best First'.|
Re^4: Tk::grid -sticky option not stretching frames
by boleary (Beadle) on Nov 14, 2018 at 20:17 UTC
I do need to move away from Tk, but I've got so much written. I distribute applications that need to work on Windows and Linux.. will gtk2 and wx work on both? Do you have a prefrence?
I have a real problem with Tk's performance especially when I add a lot of browsing widgets. I built an 'editor' from an hlist which can have 1000+ entries each with its own browseMenu and it takes forever (20 seconds???) to render... (and browseEntry was WAY slower!) the nytprof tool shows its all in adding those browse widget.
by zentara (Archbishop) on Nov 14, 2018 at 22:27 UTC
As far as speeding up Tk goes, I find that the fewer the widgets you use, the faster it will run. That usually brings you down to using 1 widget, the Tk::Canvas. You can make any type of application you want on a Tk::Canvas, and with the proper use of tags, you can make giant programs that will run very fast, principally because there is only the Canvas widget handling all the events. If you want to try making Canvas based widgets, see Tk::CanvasDirTree and Tk-CanvasDirTree which is a simple Canvas app I wrote to show how easy it is to put your own Canvas ideas into your own widget.
If I was asked to make an app, the first thing I would choose would be the Tk::Canvas, because it gives you full control over all the bindings, is very easy to use, and is fast. There are some drawbacks, like no transparency in colors, and you have to manually make you own text areas and buttons, but once you get the hang of it, it's fairly easy.
Here is a huge Canvas which takes maybe 15 seconds to build on my computer, but once it is displayed, it is quite responsive. See how it works for you. I have 1000 rows of active areas with 72 elements each, for a total of 72000 active areas, to which you can add all sorts of enter/leave, mouse click bindings, and balloons.
by boleary (Beadle) on Nov 15, 2018 at 02:27 UTC
that's pretty cool, I will take a look in depth at it... One thing I will try... I will add 1000 OptionMenus to your canvas in place of those rectangles and see how much longer it takes to build :)
Thanks for all your insight... I have used many of your posts in the past to find solutions to my Tk problems and I really appreciate it.
Hopefully I'll get to the point where I can provide the same kind of help every now and again
by zentara (Archbishop) on Nov 15, 2018 at 13:19 UTC