[Code Challenge] WxPython versus Tkinter.
WxPython versus Tkinter (A code battle to the death!) by Rick Johnson. I have in many threads declared that Tkinter (and TclTk) is currently --and has been for a decade-- the wrong choice for Python's stdlib GUI. Throughout the 90's Tkinter was fine. However we have been in the 21st century for more than a decade and Tkinter is no longer relevant. Many people have argued (weakly) that Tkinter is still valid. However their arguments have been mostly baseless opinions that sadly lack vision for the future. In this thread i intend to slay my enemies with cold hard facts based on code. It is time to put your code where your mouth is (or you foot). This will be an open challenge to *anyone* in this community, in the world, and *even* the great Guido van Rossum himself! It is now time for you (python community) to prove the worth of Tkinter or accept its demise at my hands! Some of you may think this sounds like an impossible challenge. How can one man defend his position against the entire world! Yes, it would seem impossible for one man to face an entire community in open challenge! And in most cases only a fool would challenge the world. However, i have not one ounce of fear within me while facing these odds because my position is the correct position. My position is based on facts and NOT friendship, truth and NOT tantrums, and finally vision NOT vengance! I am on the correct side of history! It is time to prove once and for all how dated and worthless Tkinter is compared to wxPython. Yes, WxPython is not as advanced as i would like it to be for a 21st century GUI library. However compared to Tkinter, Wx is light years ahead! Wx is our best hope to move Python into the 21st century. So now is the time for all you naysayers, trolls, and minions to face me in mortal combat within the arena of truth and righteousness. Ready your minds and wield your text editors for we shall battle for the glory of Python! And when i have slayed the fools with their own foolishness then ye all shall be enlightened! So PUT UP OR SHUT THE HELL UP! --- Challenge 1: (Simple Directory Viewer) --- Create a simple Directory Viewer GUI. You CANNOT use a treectrl! The point of this challenge is to show that Tkinter has no support for a true ListCtrl widget. However the Wx::ListCtrl is fully featured! For wxPython the code is simply wielding a few built in classes. For Tkinter no such ListCtrl functionality exists. You CAN create the functionality yourself (and i know this because i HAVE created it!) however it involves tons of work and still can't hold a candle to the wx::ListCtrl --- Requirements: --- How the user navigates to a folder is not important but you must display the list of files/folders in two view modes with icons; 1. Display files in both ReportView and ListView. * Reportview: ...scrollable vertical list with three columns. * Listview: ...scrollable horizontal-ly wrapping list. Note: If you do not understand the view modes just run my code for an example. But the user must be able to switch between these two modes easily. How the switching is done is unimportant -- I simply used two buttons. 2. Columns * Minimum of three cols; Name, Size, and Type (reportview). * the "Name" column must include an icon AND label (both views). * columns must be sortable by the user (reportview). * columns must be sizable by the user (reportview). 3. Items * All must be editable in place (no popup editing allowed!). * All items must be selectable/deselectable by user. * All items must be delete-able by the user. That is the challenge. Step forth and battle if you can! - WxPython code: - https://sites.google.com/site/thefutureofpython/home/code-challenges I await any challengers... -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
On 1/22/2011 7:07 PM, rantingrick wrote: Near the beginning of this thread, I gently challenged you to produce a concrete, practical proposal for an stdlib addition that could be critiqued and improved. When you asked for problems with wxwidgets/wxpython, I gave some. Still waiting. So PUT UP OR SHUT THE HELL UP! -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
From: "rantingrick" > > WxPython versus Tkinter (A code battle to the death!) > > by Rick Johnson. > > I have in many threads declared that Tkinter (and TclTk) is currently > --and has been for a decade-- the wrong choice for Python's stdlib > GUI. Throughout the 90's Tkinter was fine. However we have been in the > 21st century for more than a decade and Tkinter is no longer relevant. > Many people have argued (weakly) that Tkinter is still valid. However > their arguments have been mostly baseless opinions that sadly lack > vision for the future. > > In this thread i intend to slay my enemies with cold hard facts based > on code. It is time to put your code where your mouth is (or you > foot). This will be an open challenge to *anyone* in this community, > in the world, and *even* the great Guido van Rossum himself! It is now > time for you (python community) to prove the worth of Tkinter or > accept its demise at my hands! > > Some of you may think this sounds like an impossible challenge. How > can one man defend his position against the entire world! Yes, it > would seem impossible for one man to face an entire community in open > challenge! And in most cases only a fool would challenge the world. > However, i have not one ounce of fear within me while facing these > odds because my position is the correct position. My position is based > on facts and NOT friendship, truth and NOT tantrums, and finally > vision NOT vengance! I am on the correct side of history! > > It is time to prove once and for all how dated and worthless Tkinter > is compared to wxPython. Yes, WxPython is not as advanced as i would > like it to be for a 21st century GUI library. However compared to > Tkinter, Wx is light years ahead! Wx is our best hope to move Python > into the 21st century. > > So now is the time for all you naysayers, trolls, and minions to face > me in mortal combat within the arena of truth and righteousness. Ready > your minds and wield your text editors for we shall battle for the > glory of Python! And when i have slayed the fools with their own > foolishness then ye all shall be enlightened! > > So PUT UP OR SHUT THE HELL UP! > > > --- > Challenge 1: (Simple Directory Viewer) > --- > > Create a simple Directory Viewer GUI. You CANNOT use a treectrl! The > point of this challenge is to show that Tkinter has no support for a > true ListCtrl widget. However the Wx::ListCtrl is fully featured! For > wxPython the code is simply wielding a few built in classes. For > Tkinter no such ListCtrl functionality exists. You CAN create the > functionality yourself (and i know this because i HAVE created it!) > however it involves tons of work and still can't hold a candle to the > wx::ListCtrl > > --- > Requirements: > --- > > How the user navigates to a folder is not important but you must > display the list of files/folders in two view modes with icons; > > 1. Display files in both ReportView and ListView. > > * Reportview: >...scrollable vertical list with three columns. > > * Listview: >...scrollable horizontal-ly wrapping list. > > Note: If you do not understand the view modes just run my code for an > example. But the user must be able to switch between these two modes > easily. How the switching is done is unimportant -- I simply used two > buttons. > > 2. Columns > * Minimum of three cols; Name, Size, and Type (reportview). > * the "Name" column must include an icon AND label (both views). > * columns must be sortable by the user (reportview). > * columns must be sizable by the user (reportview). > > 3. Items > * All must be editable in place (no popup editing allowed!). > * All items must be selectable/deselectable by user. > * All items must be delete-able by the user. > > That is the challenge. Step forth and battle if you can! > > - > WxPython code: > - > > https://sites.google.com/site/thefutureofpython/home/code-challenges I have downloaded that simple program, launched it, and I've tested it with JAWS screen reader. It was fully accessible out of the box. Have you done something special for making it accessible for screen readers? (I guess not). Can be the same thing done with Tkinter? Octavian -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
rantingrick, 23.01.2011 01:07: I have in many threads declared that Tkinter (and TclTk) is currently --and has been for a decade-- the wrong choice for Python's stdlib GUI. [...] It is time to prove once and for all how dated and worthless Tkinter is compared to wxPython. What's the aim of that prove? If you are trying to pave the ground for getting wxPython in the stdlib instead of tkinter, I think that's bound to fail. Similar proposals have been rejected with the simple argument that adding a large library with a huge C dependency to the standard library without having a rock solid maintainer for both of them is not going to happen. Are you volunteering to maintain both wxPython and wxWidgets in the standard library for, say, twenty years to come? Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
rantingrick schrieb: [snip] 1. You cannot define the terms--restrict your opponent-- and battle it yourselves. 2. Your specified directory browser is useless. --At least define that the directory browser must have constant complexity to work with volatile data over a network... -roger -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
I found this code in the Demo/tkinter/ttk directory of the Python 2.7.1 source distribution. I'm NOT the author (credit should probably go to Guilherme Polo, developer of the Tkinter wrapper for the ttk themed widgets that is now in the stdlib). But, using a tree/listview widget that is part of the Tk/Tkinter core (NOT an extension), it presents a decent, simple file browser: """A directory browser using Ttk Treeview. Based on the demo found in Tk 8.5 library/demos/browse """ import os import glob import Tkinter import ttk def populate_tree(tree, node): if tree.set(node, "type") != 'directory': return path = tree.set(node, "fullpath") tree.delete(*tree.get_children(node)) parent = tree.parent(node) special_dirs = [] if parent else glob.glob('.') + glob.glob('..') for p in special_dirs + os.listdir(path): ptype = None p = os.path.join(path, p).replace('\\', '/') if os.path.isdir(p): ptype = "directory" elif os.path.isfile(p): ptype = "file" fname = os.path.split(p)[1] id = tree.insert(node, "end", text=fname, values=[p, ptype]) if ptype == 'directory': if fname not in ('.', '..'): tree.insert(id, 0, text="dummy") tree.item(id, text=fname) elif ptype == 'file': size = os.stat(p).st_size tree.set(id, "size", "%d bytes" % size) def populate_roots(tree): dir = os.path.abspath('.').replace('\\', '/') node = tree.insert('', 'end', text=dir, values=[dir, "directory"]) populate_tree(tree, node) def update_tree(event): tree = event.widget populate_tree(tree, tree.focus()) def change_dir(event): tree = event.widget node = tree.focus() if tree.parent(node): path = os.path.abspath(tree.set(node, "fullpath")) if os.path.isdir(path): os.chdir(path) tree.delete(tree.get_children('')) populate_roots(tree) def autoscroll(sbar, first, last): """Hide and show scrollbar as needed.""" first, last = float(first), float(last) if first <= 0 and last >= 1: sbar.grid_remove() else: sbar.grid() sbar.set(first, last) root = Tkinter.Tk() vsb = ttk.Scrollbar(orient="vertical") hsb = ttk.Scrollbar(orient="horizontal") tree = ttk.Treeview(columns=("fullpath", "type", "size"), displaycolumns="size", yscrollcommand=lambda f, l: autoscroll(vsb, f, l), xscrollcommand=lambda f, l:autoscroll(hsb, f, l)) vsb['command'] = tree.yview hsb['command'] = tree.xview tree.heading("#0", text="Directory Structure", anchor='w') tree.heading("size", text="File Size", anchor='w') tree.column("size", stretch=0, width=100) populate_roots(tree) tree.bind('<>', update_tree) tree.bind('', change_dir) # Arrange the tree and its scrollbars in the toplevel tree.grid(column=0, row=0, sticky='nswe') vsb.grid(column=1, row=0, sticky='ns') hsb.grid(column=0, row=1, sticky='ew') root.grid_columnconfigure(0, weight=1) root.grid_rowconfigure(0, weight=1) root.mainloop() -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
From: "Kevin Walzer" I found this code in the Demo/tkinter/ttk directory of the Python 2.7.1 source distribution. I'm NOT the author (credit should probably go to Guilherme Polo, developer of the Tkinter wrapper for the ttk themed widgets that is now in the stdlib). But, using a tree/listview widget that is part of the Tk/Tkinter core (NOT an extension), it presents a decent, simple file browser: Well, I have also tested the program dirbrowser.py, but it is not decent at all. I have tested it with JAWS screen reader and it is absolutely inaccessible. The single "accessible" things in it are the title bar which is "tk". It can't compare with the same program made using WxPython. And it can't be made to be more accessible than it is, because it uses Tk. So Tkinter is really bad. Octavian -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
On 1/24/11 1:52 AM, Octavian Rasnita wrote: Well, I have also tested the program dirbrowser.py, but it is not decent at all. I have tested it with JAWS screen reader and it is absolutely inaccessible. The single "accessible" things in it are the title bar which is "tk". It can't compare with the same program made using WxPython. And it can't be made to be more accessible than it is, because it uses Tk. So Tkinter is really bad. If accessibility leads your criteria, then yes, Tk may be deficient. I can't speak to this on other platforms or with other toolkits. -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
Octavian Rasnita wrote: From: "rantingrick" WxPython versus Tkinter (A code battle to the death!) by Rick Johnson. [...] Octavian, Please do not repost rr's crap in its entirety, or you'll find yourself added to many killfiles -- just like he is. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
From: "Ethan Furman" > Octavian Rasnita wrote: >> From: "rantingrick" >>> WxPython versus Tkinter (A code battle to the death!) >>> >>> by Rick Johnson. > [...] > > Octavian, > > Please do not repost rr's crap in its entirety, or you'll find yourself > added to many killfiles -- just like he is. :-) I am not posting anyone's crap. I just informed why Tkinter is bad. And I also don't say that WxPython is ideal, but just that it has some very important features that Tk doesn't offer. Octavian -- http://mail.python.org/mailman/listinfo/python-list
Re: [Code Challenge] WxPython versus Tkinter.
On 1/24/11 11:58 AM, Octavian Rasnita wrote: >> From: "Ethan Furman" >> Please do not repost rr's crap in its entirety, or you'll find yourself >> added to many killfiles -- just like he is. > I am not posting anyone's crap. I just informed why Tkinter is bad. > And I also don't say that WxPython is ideal, but just that it has some very > important features that Tk doesn't offer. Belatedly: The complaint was not that you had something to say in reply, but that as you replied, you quoted the entire original post. Netiquette holds that you should edit out your replies to include only those things / statements you're actually responding to. By just blanket replying and including the whole rant, you are posting that whole rant. Needlessly, as its already been said. If you cut it down and only include the points that you're responding to, you include the specific context needed to understand your statements, while minimizing the need for people to parse through noise. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list