that sounds a bit worrying. can you give some examples?
from the article i was specifically wondering about this:
And yet still, even with ttk, Python doesn't automatically pick the best theme for the OS! It often defaults to "clam", "alt", or the dreaded "classic" on Linux, which look dated. It's a mess of a Tk bridge! ... the provided bridge to it is clunky
so is it just the perception? sounds like i should just have to remember to pick a better theme. (and use ttk)
and what you say about using pandas supports my point. i usually want to add a gui to something that is written in a particular language for a reason.
Sure you can make this module and there are probably things out there, but you need to wire it up yourself before you even get to the application logic.
Last time I had to make a quick tkinter interface was like a month ago for a project I was working on just for me and I wanted a cleaner interface and I just had codex do it and it was "fine" - like nothing to write home about but "fine." If you're trying to get the most out of your macbook or whatever, the default is kind of bad.
I would say you're correct, it's perception.
> and what you say about using pandas supports my point. i usually want to add a gui to something that is written in a particular language for a reason.
This is exactly why I never even thought to use Tcl to call python before, because you'd end up with something like this for each function you wanted to call in python:
import argparse
from other_library import super_important_function
def do_the_thing():
parser = argparse.ArgumentParser()
parser.add_argument("--data_file", type=str, default="report.dat")
args = parser.parse_args()
super_important_function(args.data_file)
if __name__ == "__main__":
do_the_thing()
And I guess the question is, do you want to be doing that 20 times for your Tcl app, or do you want to just write a python app? In my mind, a "pure" python app in this case is probably smarter, because you could do something like this: import tkinter as tk
from tkinter import filedialog
from other_library import super_important_function
def open_file():
filename = filedialog.askopenfilename()
# now bear with me, I always have to remember if filedialog and the like
# return strings or pathlikes, but you get the picture...
if filename:
super_important_function(filename)
root = tk.Tk()
root.title("Pick a File")
button = tk.Button(root, text="Do super important thing on file!", command=open_file)
button.pack()
root.mainloop()
I guess it's personal preference at a certain point, yah. I would say "just use ttk and pick a good theme" is probably the right call. They mentioned some stuff about concurrency in the article and tcl being guaranteed to be responsive, etc. Despite abusing the hell out of tkinter in python, I had no problem rendering multiple windows I had up while I had pandas grind away tens of thousands of datapoints, so YMMV, but tkinter in that application worked fine. But from a "code maintenance" and "bus factor" sort of thing, I would say this is probably easier to figure out wtf is going on with a tkinter app over calling a bunch of python scripts from your Tcl app? But again, it's preference.One of the things I really don't like about big complex tkinter apps (and this may very well be a skill issue on my part) is that in my experience if you're not really careful they tend to end up being monolithic apps with functions and windows bolted on as needed, and the parent/child relationship between windows gets confusing. Again, this is likely just me being dumb at precisely the wrong time, but I kind of think think the python of it is a little bit kind of confusing. I've thought about trying to get good enough at Racket or something similar to build a DSL for generating tkinter python interfaces? But honestly, I haven't really had both the need for something like that or the time. That said, it would be awesome do have something where I could do:
<root layout="grid">
<label row=0, col=1>Hello world</label>
<button row=1, col=1, callback=cool_function>click me!</label>
</root>
And have that emit clean python? But... in the world of LLMs etc. I don't know that the juice is worth the squeeze?Still, wrt the article, I could totally see a situation where it would be better to wire a bunch of other scripts together with Tcl. Imagine your shop has utilities and tools in Go, Python, Bash, whatever. and you needed to wire them all together? That would be an excellent case for doing something like what they described. And like I said, I might try this on the next project where I need a quick GUI.