tags:

views:

45

answers:

2

slebetman says:

But Tk is only really ugly on Unixen because it defaults to a Motif theme (modern Tk is/should be replaced by TTk which is themeable).

Given two Tk apps which I still use occasionally, namely Gitk and ptkdb, how do I change their look and feel so that it matches the rest of the desktop environment (KDE 4)?

A: 

Check out the TkDocs website, everything I know about modern Tk I learnt from there! Well and experience too of course ;-)

It will not be simple to retrofit it onto a substantial legacy application, but you could probably get surprisingly far by just prefixing the widgets with ttk::.

Gaius
That's disappointing to learn. I tested out what you said by substituting `Tk::` with `Tkx::` in ptkdb, but it won't run anymore because the API difference is greater than that. If a rewrite is necessary, then one might as well pick a mainstream toolkit. I'll leave the question open in case someone knows a solution that does not involve programming to that great extent.
daxim
A: 

See: http://wiki.tcl.tk/gtklook.tcl for a quick way to make default Tk look less painfully ugly. I often use it in my own programs to hide the fact that it's actually written in tcl/tk.

The code given is tcl but you can easily use the options in an Xresources or Xdefaults file which I think should work in other languages as well. Or, it that doesn't work I believe there is an equivalent option method in Perl/Tk*.

Yes, the changes are not much. Basically just reducing pixel widths of things like borders and scrollbars. But it does look much nicer.

*note: I only mention Perl/Tk because you mentioned it in another post. As for modifying gitk, it is written in tcl so you can easily copy-paste the code somewhere.

slebetman
In `gitk` after `package require Tk` I added `lappend auto_path /home/daxim/local/share/tcl-style␤package require style␤style::use as` (also tried: `style::use lobster`), but it made no difference at all. Anyway, this requires so much Tcl programming for each single program and I don't want to do that. I had hoped to instead just set GUI options somewhere or change a config files so it takes place globally. I accept you *pro forma*.
daxim