Thank you, Tkinter. (easy to use)
Tonight I needed to draw a series of simple shapes in a window using a bit of math but didn't have much time to do it. I've got very little GUI toolkit experience. Briefly had a look at the usually-recommended heavyweight GUI toolkits, but I didn't want to inherit from widget classes or override paint methods (not that those things don't have their place). I just wanted to quickly draw some shapes. Within a few minutes I had what I needed, and it was by using Tkinter. The code looked something like this: #!/usr/bin/env python import Tkinter as tk root = tk.Tk() canv = tk.Canvas(root, width=647, height=400, background='white') canv.pack(side=tk.TOP, fill=tk.BOTH, expand=1) # drawing happens here ... canv.create_oval(50, 80, 150, 180) # ... root.mainloop() Wow that was *really* easy. After playing around just a bit more, regular GUI programs are pretty quick and simple to make as well. My only (minor) complaint is that Tk doesn't draw text antialiased in the various widgets (menus, labels, buttons, etc.). Anyway, thanks Tk and Tkinter! -- http://mail.python.org/mailman/listinfo/python-list
Re: Thank you, Tkinter. (easy to use)
On Feb 12, 4:29 am, "Eric Brunel" wrote: > On Thu, 12 Feb 2009 06:06:06 +0100, wrote: > > [snip] > > > My only (minor) complaint is that Tk > > doesn't draw text antialiased in the various widgets (menus, labels, > > buttons, etc.). > > From version 8.5 of tcl/tk, it's supposed to do it. See this > page:http://www.tcl.tk/software/tcltk/8.5.tml > under 'Highlights of Tk 8.5', item 'Font rendering'. It seems to talk only > about X11 and Mac OS X; don't know if it works on Windows... Looking forward to it. Searching around some more, also found this: http://tkinter.unpythonic.net/wiki/Tk85AndPython which sheds a little light. And following a link therein, it would seem that we'll have it by default with Python 2.7/3.1 -- [this bug](http://bugs.python.org/ issue2983) was closed about 2 weeks ago. -- http://mail.python.org/mailman/listinfo/python-list
Re: Thank you, Tkinter. (easy to use)
On Feb 12, 4:29 am, "Eric Brunel" wrote: > On Thu, 12 Feb 2009 06:06:06 +0100, wrote: > > [snip] > > > My only (minor) complaint is that Tk > > doesn't draw text antialiased in the various widgets (menus, labels, > > buttons, etc.). > > From version 8.5 of tcl/tk, it's supposed to do it. See this > page:http://www.tcl.tk/software/tcltk/8.5.tml > under 'Highlights of Tk 8.5', item 'Font rendering'. It seems to talk only > about X11 and Mac OS X; don't know if it works on Windows... I also don't know about MS Windows. I've been fortunate enough to not have to use that OS for *years*. Also, after some more searching, found this: http://tkinter.unpythonic.net/wiki/Tk85AndPython And according to [this](http://bugs.python.org/issue2983), the ttk support has been merged into Python 2.7/3.1 as of about 2 weeks ago. -- http://mail.python.org/mailman/listinfo/python-list
Easier to wrap C or C++ libraries?
When creating a Python binding to a C or C++ library, which is easier to wrap, the C lib or the C++ one? Given a choice, if you had to choose between using one of two libs, one written in C, the other in C+ + -- both having approximately the same functionality -- which would you rather deal with from your Python code? It would seem to me that there's fewer design considerations when wrapping a library written in C; you just wrap the functions. However, since Python supports OOP nicely, it might also be that wrapping C++ code *could* also be staightforward... Are there many pitfalls when having to map C++'s notion of OO to Python? -- http://mail.python.org/mailman/listinfo/python-list
Re: Easier to wrap C or C++ libraries?
On Feb 14, 12:14 pm, "Diez B. Roggisch" wrote: > > The answer is easy: if you use C, you can use ctypes to create a wrapper > - with pure python, no compilation, no platform issues. > > Which IMHO makes a strong point for C - if you need OO, it's bolted on > easily using Python itself, by creating some nice wrapper classes. > Thanks for the replies, everyone. After posting I went back and reviewed some of my old C books as well as the C++ ones. It's interesting and instructive to look back at C++ after you've used languages like Python for a while. I'd forgotten how complicated C++ code can get. -- http://mail.python.org/mailman/listinfo/python-list
