ANN: EPD 6.2 released
Hello, I am pleased to announce that EPD (Enthought Python Distribution) version 6.2 has been released. This release includes an update to Python 2.6.5, SciPy 0.8.0beta1, as well updates to many other packages and bug fixes. You can find a complete list of updates in the change log: http://www.enthought.com/EPDChangelog.html To find more information about EPD, as well as download a 30 day free trial, visit this page: http://www.enthought.com/products/epd.php In order to be able to serve the Python community better, we made a small survey. Please consider taking a few minutes: http://www.surveygizmo.com/s/307237/epd-user-feedback About EPD - The Enthought Python Distribution (EPD) is a kitchen-sink-included distribution of the Python Programming Language, including over 80 additional tools and libraries. The EPD bundle includes NumPy, SciPy, IPython, 2D and 3D visualization, and many other tools. http://www.enthought.com/products/epdlibraries.php It is currently available as a single-click installer for Windows XP, Vista and 7, MacOS (10.5 and 10.6), RedHat 3, 4 and 5, as well as Solaris 10 (x86 and x86_64/amd64 on all platforms). The 32-bit EPD is free for academic use. An annual subscription including installation support is available for individual and commercial use. Additional support options, including customization, bug fixes and training classes are also available: http://www.enthought.com/products/support_level_table.php - Ilan -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Syntax problem - cannot solve it by myself
On Wed, 09 Jun 2010 02:45:36 +, Deadly Dirk wrote: On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: Unless you have a clear need for 3rd party libraries that currently don't have 3.x versions, starting with Python 3 isn't a bad idea. From what I see, most of the people are still using Python 2.x. Yes, that is correct, most people are still on 2.x. However, many people are dipping their toe into 3.x by using both, or even exclusively on 3. Most is not all. Remember than many deployed systems only have Python 2.6, 2.5 or even 2.4 as standard, and until the vendors start shipping 3.x as standard, many people will be stuck using 2.x even if they want to upgrade. My reason for learning Python is the fact that my CTO decided that the new company standard for scripting languages will be Python. And what version of Python will you be using? I've been using Perl for 15 years and it was completely adequate but, apparently, Perl is no longer in. Yes, being pushed out of a 15 year comfort zone is painful. Good luck! I am afraid that Python3 is like Perl 6, the one with Parrot: everybody is reading articles about it but nobody is using it. Python 3 is actually shipping. While it is a backwards-incompatible change from Python 2, it is an incremental change and not a complete re- write. Large amounts of Python 2.x code will Just Work in Python 3, and even larger amounts can be automatically converted using the 2to3 tool. Very little needs to be re-written by hand. Most of the changes in Python 3 are additions, not subtractions. As the What's New says: you’ll find that Python really hasn’t changed all that much – by and large, we’re mostly fixing well-known annoyances and warts, and removing a lot of old cruft. http://docs.python.org/release/3.0.1/whatsnew/3.0.html People tend to fixate on things from 2.x that changes, but 3.x also introduces many new features, like annotations, keyword-only arguments, nonlocal, dict and set comprehensions, and ordered dicts. The two biggest roadblocks for Python3.x use are: * distributions are conservative and are still shipping older versions of Python; * while some web frameworks do support Python 3.x, some important 3rd party libraries still don't (e.g. PIL, numpy). If you're not using those libraries, or stuck on an old conservative server, there's absolutely no reason not to start using Python 3.1. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Tue, 08 Jun 2010 16:58:26 -0700, rantingrick wrote: We have a problem You keep saying that, but you've given no good reasons for why we should believe you, or what the nature of this problem supposedly is. The current situation has broad community support: there's a relatively lightweight GUI toolkit that ships with Python (Tkinter), even if it's not beloved by all neither is it especially hated, and an extremely healthy ecosystem of many alternative GUIs built on top of Qt, wxWindows, GTK+, and others. Where's the problem? So keep the ideas rolling in people. We need to hear from every side of this forum. I think the only way to end this pointless discussion is this: Hitler would have loved Tkinter! Now that we've run into Godwin's Law, can we get back to something more productive? No need to thank me. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/9/10 1:12 AM, rantingrick wrote: On Jun 8, 10:09 pm, Robert Kernrobert.k...@gmail.com wrote: It means that he, very charitably, gives new irritants the benefit of the doubt. By changing identities, you are abusing this good behavior. By connecting your identity to the previous one, his doubt is removed. And again you miss the very meat and potatoes of my post. Sadly like Ben you're so blinded by animosity that you cannot see. He kill-filed me because he is so vehemently against me on a personal level. You can read minds? So much against me that even the sight of the very words i write send him into fits of uncontrollable rage. And clairvoyance! Such wonders! This must be the case or why would he need to hide his eyes completely from my words. Could he not just exercise a bit of self restraint and skip my posts if they start to annoy too much? Yes, he is. He happens to be using a technological aid in order to do so efficiently. You misunderstand the purpose of a kill-file. Apparently not. He is unable to control his actions so he must go to the extreme of kill-file. But you know i think it boils down to fear really. He is comfortable in his life and wishes to keep it as cookie cutter as he can. Any outside influence must be quashed before these meddling forces can take hold of him. He is so fearful of seeing the light in an opposing argument that blinding himself from reality is easier than facing reality. Ah, so you are a psychoanalyst, too? Amazing! -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, Jun 9, 2010 at 2:12 AM, Robert Kern robert.k...@gmail.com wrote: On 6/9/10 1:12 AM, rantingrick wrote: snip But you know i think it boils down to fear really. He is comfortable in his life and wishes to keep it as cookie cutter as he can. Any outside influence must be quashed before these meddling forces can take hold of him. He is so fearful of seeing the light in an opposing argument that blinding himself from reality is easier than facing reality. Ah, so you are a psychoanalyst, too? Amazing! How do you think he mad so many incorrect predictions, eh? Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Kevin Walzer wrote: PyGUI ... certainly is *not* a lightweight GUI toolkit that could easily be incorporated into the Python core library--it instead has rather complex dependencies on both other GUI toolkits and Python wrappers of those toolkits. I don't see how the dependencies could be regarded as complex. There's more or less only one on each platform, and they're pretty standard accessories for the platform concerned. You could say there are two on Linux if you count gtk itself, but you almost certainly already have it these days if you're running any kind of desktop at all. It's true that just having PyGUI itself in the standard library wouldn't be sufficient, but that's also true of Tkinter today -- you need Tcl/Tk installed in order to use it, and that doesn't come bundled with Python on all platforms. The same thing applies to some other stdlib modules, such as sqlite. So just having a dependency doesn't necessarily preclude a package from being included in the stdlib. Having said all that, I would like to eliminate some of the depedencie. At some point I'll probably re-do the Windows implementation using ctypes, because pywin32/mfc is hindering more than helping in some areas. I'm also thinking about ways to interface directly with Cocoa without going through pyobjc. But all that is some way off in the future after I get the API nailed down more. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: why any( ) instead of firsttrue( ) ?
On Jun 8, 2:16 pm, danieldelay danielde...@gmail.com wrote: def firsttrue(iterable): for element in iterable: if element: return element return None This function firsttrue( ) could probably be used anywhere any( ) is used, but with the ability to retrieve the first element where bool(element) is True, which may be sometimes usefull. FWIW, it's not hard to roll your own fast itertools variants of any() and all(): next(ifilter(None, d), False) # first true, else False next(ifilterfalse(None, d), True) # first false, else True Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 81, Issue 63
import tkinter root = tkinter.Tk() #initialize tkinter and get a top level instance root.title(madhuri is a python) canvas = tkinter.Canvas(root) #creating the canvas under the root canvas.pack() #to call the packer geometry canvas.create_rectangle(20,10,120,80,fill=colors[0]) root.close() tk.destroy() this is the program i have written and i am unable to execute it as i get an attribute error like this... $ python tkinter.py Traceback (most recent call last): File tkinter.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'tk' where is the mistake and what do i do ???its a ll urgent On Tue, Jun 8, 2010 at 3:30 PM, python-list-requ...@python.org wrote: Send Python-list mailing list submissions to python-list@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-list or, via email, send a message with subject or body 'help' to python-list-requ...@python.org You can reach the person managing the list at python-list-ow...@python.org When replying, please edit your Subject line so it is more specific than Re: Contents of Python-list digest... Today's Topics: 1. Re: UnboundLocalError: local variable referenced before assignment (Chris Rebert) 2. Re: Which objects are expanded by double-star ** operator? (Bryan) 3. Re: Which objects are expanded by double-star ** operator? (kkumer) 4. Re: UnboundLocalError: local variable referenced before assignment (ch1zra) 5. Re: Plotting in batch with no display (Giacomo Boffi) 6. Re: Plotting in batch with no display (Giacomo Boffi) 7. Re: Which objects are expanded by double-star ** operator? (kkumer) 8. Re: Reading file bit by bit (Martin) -- Forwarded message -- From: Chris Rebert c...@rebertia.com To: ch1zra ch1...@gmail.com Date: Tue, 8 Jun 2010 02:25:02 -0700 Subject: Re: UnboundLocalError: local variable referenced before assignment On Tue, Jun 8, 2010 at 2:00 AM, ch1zra ch1...@gmail.com wrote: On Jun 8, 10:29 am, Richard Thomas chards...@gmail.com wrote: On Jun 8, 9:03 am, ch1zra ch1...@gmail.com wrote: I have following code : import os, time, re, pyodbc, Image, sys from datetime import datetime, date, time from reportlab.lib.pagesizes import A4 from reportlab.lib.units import cm from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont import mkTable mkTable.mkTable() and then file mkTable.py located in same directory has : def mkTable(): global canvas canvas = canvas.Canvas(fname, pagesize=A4) ... and so on this gives me following traceback: Traceback (most recent call last): File C:\py\pdf_test.py, line 36, in module mkTable.mkTable() File C:\py\mkTable.py, line 38, in mkTable canvas = canvas.Canvas(K_lista.pdf, pagesize=A4) UnboundLocalError: local variable 'canvas' referenced before assignment i haven't posted entire code, because those lines are giving me problems. I've searched the web, and all say that I should make var global inside function. so I did it, but still nothing... using python 2.6.2 and reportlab 2.4 help plz :) The version of mkTable.py you posted is clearly different to the one in the traceback. You might want to check that. Richard. here's full version of mkTable.py (I've cut out all the drawing code for clarity) http://bpaste.net/show/7003/ and it's caller : http://bpaste.net/show/7004/ and the newest traceback (just generated): Traceback (most recent call last): File C:\py\pdf_test.py, line 36, in module mkTable.mkTable() File C:\py\mkTable.py, line 38, in mkTable canvas.setFillColorRGB(0.8,0.8,0.8) UnboundLocalError: local variable 'canvas' referenced before assignment mkTable.py: # -*- coding: utf-8 -*- def mkTable(): global canvas snip canvas = canvas.Canvas(K_lista.pdf, pagesize=A4) The only global variable defined in mkTable.py is the mkTable function (partly since you don't import anything). So the reference to the global variable canvas on the right-hand side of this expression is completely undefined, resulting in the error you're getting. In this respect, your code is akin to: whatever.py: # -*- coding: utf-8 -*- def foo(): global x x = 2 * x foo() # This is obviously horribly flawed since x is never given an initial value! #EOF More generally, your code uses canvas to refer both to the module reportlab.pdfgen.canvas and an instance of the class reportlab.pdfgen.canvas.Canvas; this is confusing and problematic. I suggest you either rename one of them to something distinct (e.g. `import reportlab.pdfgen.canvas as
Re: Python-list Digest, Vol 81, Issue 63
: import tkinter root = tkinter.Tk() #initialize tkinter and get a top level instance root.title(madhuri is a python) canvas = tkinter.Canvas(root) #creating the canvas under the root canvas.pack() #to call the packer geometry canvas.create_rectangle(20,10,120,80,fill=colors[0]) root.close() tk.destroy() this is the program i have written and i am unable to execute it as i get an attribute error like this... $ python tkinter.py Traceback (most recent call last): File tkinter.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'tk' where is the mistake and what do i do ???its a ll urgent -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Martin P. Hellwig wrote: I do think it is technically possible to have your own window manager in python on x11 but I have no idea if you have equal possibilities on mac and windows (for example to define your own window decoration). Though considering tk does just that I would guess this to be the case. To my knowledge, neither Windows nor MacOSX have a replaceable window manager in the sense that X11 does. However, it's always possible for an application to create a window with none of the standard borders or decorations and fake them itself, which is what I expect Tk is doing here. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 81, Issue 63
On Tue, Jun 8, 2010 at 11:57 PM, madhuri vio madhuri@gmail.com wrote: import tkinter root = tkinter.Tk() #initialize tkinter and get a top level instance root.title(madhuri is a python) canvas = tkinter.Canvas(root) #creating the canvas under the root canvas.pack() #to call the packer geometry canvas.create_rectangle(20,10,120,80,fill=colors[0]) root.close() tk.destroy() this is the program i have written and i am unable to execute it as i get an attribute error like this... $ python tkinter.py Traceback (most recent call last): File tkinter.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'tk' where is the mistake and what do i do ???its a ll urgent *Don't name your module the same name as a built-in module.* Rename your /home/manoj/tkinter.py file to something else. Also, it seems that line should be root = tkinter.Tk() with a capital T; your actual code doesn't match the code snippet you posted. Finally, to start a new topic/thread on the mailinglist, *please don't reply to a random digest*. Follow the instructions in the digest message itself: On Tue, Jun 8, 2010 at 3:30 PM, python-list-requ...@python.org wrote: Send Python-list mailing list submissions to python-l...@python.org actual unnecessary digest snipped Regards, Chris -- Netiquette; sigh. http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
help me
this is the code i have written ..even after changing d module name i am still getting the same error... what do they mean by an attribute error...can u explain in detail i am unable to proceed further... #!usr/bin/env python #making structured graphics using tkinter interface import tkinter a = tkinter.Tk() #initialize tkinter and g$ a.title(madhuri is a python) canvas = tkinter.Canvas(a)#creating the canvas unde$ canvas.pack() #to call the packer geome$ canvas.create_rectangle(20,10,120,80,fill=colors[0]) a.close() and the error is $ python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.Tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'Tk' its a lil urgent please -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
On Wed, Jun 9, 2010 at 12:18 AM, madhuri vio madhuri@gmail.com wrote: this is the code i have written ..even after changing d module name i am still getting the same error... You still haven't renamed /home/manoj/tkinter.py to something else. Otherwise it wouldn't still be mentioned in the error traceback! I suspect you've renamed the wrong module. snip $ python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.Tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'Tk' its a lil urgent please http://www.catb.org/~esr/faqs/smart-questions.html#urgent ==Don't flag your question as “Urgent”, even if it is for you== That's your problem, not ours. Claiming urgency is very likely to be counter-productive: most hackers will simply delete such messages as rude and selfish attempts to elicit immediate and special attention. There is one semi-exception. It can be worth mentioning if you're using the program in some high-profile place, one that the hackers will get excited about; in such a case, if you're under time pressure, and you say so politely, people may get interested enough to answer faster. This is a very risky thing to do, however, because the hackers' metric for what is exciting probably differs from yours. Posting from the International Space Station would qualify, for example, but posting on behalf of a feel-good charitable or political cause would almost certainly not. In fact, posting “Urgent: Help me save the fuzzy baby seals!” will reliably get you shunned or flamed even by hackers who think fuzzy baby seals are important. Regards, Chris -- I should stop procrastinating by answering these... http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
sir
i am sorry for using such a word urgent...its just that i am unable to progress and i have u as the only source of help... i was wondering how to rename the module i renamed it to madhu.py -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
FREE Just ONE Click To Obtain Success With Click2Sell.
# All That Which Is Stated Here Is Completely Honest And AbsolutelyFREE # Click2Sell Affiliate Marketing Network will be a valuable support for your business and can help you to become a successful Internet marketer or to become one of the top most successful affiliates in the world. Whether you're just beginning your career as an Internet marketer or already have experience in the Internet marketing field – Click2Sell Affiliate Network just has to be the organization for you. Do not let this opportunity pass you by, but allow us to truly Welcome YOU and help you to succeed in this Community! # Innovative Affiliate Network Online - Click2Sell Affiliate Marketing Network # Merchants - Sell Products Online With Affiliates Help. # Affiliates - Promote Products Online And Earn Commissions. # Advanced Customer Support. The moment you become a Click2Sell affiliate network member, you are no longer alone in the affiliate marketing world. # Powerful Reporting System. Track your achievements 24/7. # Sell or Promote products on line with the Click2Sell Affiliate Marketing where merchants and affiliates find each other and make great deals. Join us and increase profits using the benefits of our innovative affiliate network. # Go now to http://alturl.com/5qxi # All That Which Is Stated Here Is Completely Honest And AbsolutelyFREE # Do Not Be Suspicious. Just Think of a Free Market, Where You Pay A Fee Or A Commission If And When And ONLY WHEN You Make A Sale # FREEJust ONE Click To Obtain Success With Click2Sell. -- http://mail.python.org/mailman/listinfo/python-list
Python scripting in Ultraspider web crawler?
Hi there! Does anybody on the list have experience on processing output from the Ultraspider web crawler with Python? I am using the Ultraspider web crawler to crawl a web site and then send the web pages' content and metadata to an Autonomy IDOL search engine. However, I want to do some processing on the web pages that the Ultraspider web crawler finds first and I have understood Python is the language one should be able to use with Ultraspider to do document processing. All ideas and pointers welcome! Best regards, Mickel Grönroos Stockholm -- http://www.linkedin.com/in/mickel -- http://mail.python.org/mailman/listinfo/python-list
Java Developer with Chordiant, Hyderabad
Greetings! Hi , Very Good Day, Currently one of my client, CMM Level 5 company is looking for Java Developer with Chordiant 2 -5 Years of experience. Title: Java Developer with Chordiant Location: Hyderabad, India Qualifications : B.E/BTech/MTech/ MCA Experience : 2-5yrs relevant Preference will be given to the candidates who are willing to join ASAP. Job Description: Technical Skills required: Expertise in Chordiant is compulsory Secondary skills : Data Management, Campaign Management and Computer Telephonic interface(preferenc e will be given) Java Developer with Chordiant Skill set: 1. Chordiant Foundation Server Development. 2. Contact Center Advisor, CTI, CAFÉ Server. 3. Data Management, Campaign Management and Computer Telephonic interface. 4. Java/J2EE (Servlet, Java Script, JSP, HTML, XML, EJB, JMS, AJAX) 5. Packaging build tools like ANT, Cruse control and\or Maven. 6. Web sphere, Tomcat or Web logic. 7. RAD +7, My Eclipse. 8. Version Control Systems (PVS, Harvest, CVS). 9. SQL, PLSQL, TSQL. 10. Oracle or RDBMS as MSSQL/DB2. 11. UNIX Operating Systems and Shell Scripting. 12. Emerging Technologies as TDD, Spring Framework, Hibernate Framework, Components Web Based Framework (JSF, Tapestry) 13. Java, J2EE Design Patterns like MVC, Composite, Proxy. 14. SOA (Web Services, SOAP, ESB). Roles and Responsibilities: Analysis of Service Requests Preparation of Technical and Design documents Preparation of Test Plans Coding by strictly following the guidelines Unit Testing of CRs/Issues/ITSRs Testing of modules in Development / UT regions Preparation of Project Documents Communication with customers on assigned work Participate in Internal and External Audits Follow defined Processes and Procedures Interested Candidates please forward your updated resume with below mentioned details ASAP. Name: Email: Contact: Current Location: Ready to relocate Hyderabad Y/N: Notice Period: Current CTC: Expecting CTC: Total IT Experience: Relevant experience in Java/J2EE Technologies: Relevant experience in Chordiant Development : Thanks Regards, Sravanti. sravanti.care...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
sir
url[, data[, timeout]) in this format of passing arguments i dint understand d syntax...d comma is coming immediately after the bracket...dint get it.. -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
sir
i am working on linux sir #!usr/bin/env python #making structured graphics using tkinter interface import tkinter a = tkinter.Tk() #initialize tkinter and get a top level instance a.title(madhuri is a python) canvas = tkinter.Canvas(a)#creating the canvas under the root canvas.pack() #to call the packer geometry canvas.create_rectangle(20,10,120,80,fill=colors[0]) a.close() and the error is like... python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.Tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'Tk' kindly let me know so that i can create a front end and proceed..what do they mean by attribute error -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Lie Ryan wrote: Much like regex a DSL for matching text, Tcl/Tk is pretty much a DSL for creating GUI I can't see any things about the tcl language that make it especially good for describing GUIs, and even if there were such things, Tkinter pretty much hides the existence of tcl completely, so you wouldn't get any advantage from them in Python anyway. (And BTW the DSL conventionally used to express regexps is *horrible* for anything but the very simplest ones, IMO.) -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Non Sequitur: Re: Python Forum
rantingrick wrote: I ate three fishes just sounds wrong to me. What's the plural of sheep Stephen :-D It's sheepses, isn't it? Am I missing something? -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 3:18 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: I can't see any things about the tcl language that make it especially good for describing GUIs, And neither can i. And thats because Tcl's syntax is great for obfuscation and really nothing more. Anyone who thinks differently i encourage you to put a Tkinter and TclTk script of the same GUI side by side and you'll see exactly what i mean. It's like night and day! Sure Python does make you type a lot more text but in the end (when maintenance time comes around) which would YOU rather debug? And just think, if the balance of the world ever came down to a thumb wrestling contest. Well then all that finger exercise will pay off enormously! ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 06/09/10 08:20, Martin P. Hellwig wrote: However I don't think that x11 represents that majority (just a gut feeling I have no data to back this claim up) of gui users, so an equal solution should be found for windows and macs. I do think it is technically possible to have your own window manager in python on x11 but I have no idea if you have equal possibilities on mac Doesn't Mac uses an X server as well? -- http://mail.python.org/mailman/listinfo/python-list
Re: Non Sequitur: Re: Python Forum
On Wed, Jun 9, 2010 at 1:19 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: rantingrick wrote: I ate three fishes just sounds wrong to me. What's the plural of sheep Stephen :-D It's sheepses, isn't it? Am I missing something? Shyp. Pronounced the same way, just spelled differently. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
sir
sir i am wanted to know more in detail about expressions ..if u can give an abstract idea... -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
pprint
sir what is the function of pprint??? could you please help me out with that -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
passing data to Tkinter call backs
Hi, If this is the wrong place for Tkinter in python please direct me elsewhere! I'm trapping mouse clicks using canvas.bind(ButtonRelease-1, mouse_clik_event) def mouse_clik_event (event) : stuff What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? Or am I reduced to using spit global data? A Singleton is just Global Data by other means. -- Nick Keighley This led to packs of feral Global Variables roaming the address space. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, Jun 9, 2010 at 1:45 AM, Lie Ryan lie.1...@gmail.com wrote: On 06/09/10 08:20, Martin P. Hellwig wrote: However I don't think that x11 represents that majority (just a gut feeling I have no data to back this claim up) of gui users, so an equal solution should be found for windows and macs. I do think it is technically possible to have your own window manager in python on x11 but I have no idea if you have equal possibilities on mac Doesn't Mac uses an X server as well? Nope, it uses Quartz: http://en.wikipedia.org/wiki/Quartz_(graphics_layer) Apple does offer X11.app though, but that just runs on top of Quartz and is there to let you run *nix GUI programs. Cheers, Chris -- Democracy is in jeopardy; Existentialism is depressing. http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
madhuri vio wrote: this is the code i have written ..even after changing d module name i am still getting the same error... what do they mean by an attribute error...can u explain in detail i am unable to proceed further... #!usr/bin/env python #making structured graphics using tkinter interface import tkinter a = tkinter.Tk() #initialize tkinter and g$ a.title(madhuri is a python) canvas = tkinter.Canvas(a)#creating the canvas unde$ canvas.pack() #to call the packer geome$ canvas.create_rectangle(20,10,120,80,fill=colors[0]) a.close() and the error is $ python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter File /home/manoj/tkinter.py, line 6, in module root = tkinter.Tk() #initialize tkinter and get a top level instance AttributeError: 'module' object has no attribute 'Tk' its a lil urgent please The original post was a reply to the digest, and you understand why that was a mistake. But once you've created a new thread, you *DO* need to stick with it, using Reply-All to keep the responses in one place. As Chris says, you didn't rename the module. You still have a file called tkinter.py in your home/monoj directory. Probably, you copied the module,. instead of renaming it. So remove the one you're not using, and you'll get past this problem. The point is that the import is finding that module, rather than the one in the library, and everything else follows from that. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Tue, 2010-06-08 at 18:49 -0700, geremy condra wrote: On Tue, Jun 8, 2010 at 6:20 PM, Adam Tauno Williams awill...@whitemice.org wrote: On Tue, 2010-06-08 at 18:12 -0700, geremy condra wrote: * IronPython relies on the .Net environment for everything Since .Net (effectively) depends on Windows, 100% False; not effectively true at all. I run [and develop] .NET applications on LINUX every day. IL and the CLR are standards. Fine, then they can ship it with Linux too, Uhm... they do. At least in every major distro: openSUSE, Ubuntu, .. just for you. My point stands. No, you are wrong, factually, -- Adam Tauno Williams awill...@whitemice.org LPIC-1, Novell CLA http://www.whitemiceconsulting.com OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
Nick Keighley a écrit : Hi, If this is the wrong place for Tkinter in python please direct me elsewhere! I'm trapping mouse clicks using canvas.bind(ButtonRelease-1, mouse_clik_event) def mouse_clik_event (event) : stuff What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? Never used TkInter much, but if event is a regular Python object, you don't need any user-data field - just set whatever attribute you want, ie: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. class Event(object): pass ... e = Event() e.user_data = here are my data e.user_data 'here are my data' But I fail to see how this would solve your problem here - where would you set this attribute ??? Or am I reduced to using spit global data? A Singleton is just Global Data by other means. from functools import partial data = dict() def handle_event(event, data): ... data['foo'] = bar ... print event ... p = partial(handle_event, data=data) p(e) __main__.Event object at 0xb75383ec data {'foo': 'bar'} Note that data doesn't have to be global here. -- http://mail.python.org/mailman/listinfo/python-list
Re: function that counts...
In article l3172q@spenarnc.xs4all.nl, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: In article 4bf442cd$0$31377$4fafb...@reader1.news.tin.it, superpollo ute...@esempio.net wrote: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)): sum += int(s[j]) if sum == m: tot += 1 return tot .: In [207]: prttn(25, 1) Out[207]: 348 any suggestion for pythonizin' it? I don't like the excursion to string and back. def x(i) : return x(i/10)+i%10 if i else 0 Can't be made to work easily. or if you can't stand recursion: def x(i): s= 0 while i: s += i%10 i /= 10 return s The above doesn't work. This one has been tested: def x(i): s= 0 while i: s *= 10 s += i%10 i /= 10 return s (With as loop-invariant the concatenation of i and reversed-s and as loop-variant i) Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- http://mail.python.org/mailman/listinfo/python-list
Re: optparse: best way
On Jun 8, 3:03 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: hiralwrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option(-oexe', dest=exe_file...) parser.add_option(-otxt', dest=txt_file...) parser.add_option(-opdf', dest=pdf_file...) parser.add_option(-oppt', dest=ppt_file...) The above way is the most simple way to parser options. Can you please suggest any other best way / optimized way to parse these kind of options. Thank you in advance. Here's a solution: import optparse class Process: PREFIX = 'dispatch_' @staticmethod def undef(): print 'unsupported file type' @staticmethod def dispatch_exe(): print 'Hello exe file !' def dispatchFileType(option, opt, value, parser): Called by the parser, -o option. # call the corresponding method in the process method getattr(Process, Process.PREFIX + value, Process.undef)() parser = optparse.OptionParser() parser.add_option(-o, --output-fileType, type=string, action=callback, callback=dispatchFileType) options, args = parser.parse_args() Cheers, JM- Hide quoted text - - Show quoted text - Hi JM, Here it gives... $ python above_script.py -oexe abc Hello exe file ! {'output_fileType': None} # print options ['abc'] # print args In my case I require to have 'options' to consume 'abc' like... {'output_fileType': 'abc'} Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: optparse: best way
On Jun 8, 4:30 pm, Hrvoje Niksic hnik...@xemacs.org wrote: Thomas Jollans tho...@jollans.com writes: UNIX and GNU recommendations. I've never actually heard of optparser, but I'd expect it to have the usual limitations: Hiralprobably meant to write optparse, which supports GNU-style options in a fairly standard and straightforward way. Which includes that defining a -o/--output-format option that takes an argument allows you to write one of -o exe, -oexe, --output-format=exe, or --output-format exe. My recommendation is to use -o, and -oexe will work just fine. Thank you all :) for your kind suggestins. All your suggestions are fine and valid, which suggest to have option '-o' and take its value 'exe ppt pdf txt' etc. Yes, I am planning to use GNU style options... One advantage with this that user can pass a.txt but can specify it as '-oexe' and it would get executed as 'process_exe()'. So to say we don't have support for '-oextensions value' in python; but there are ways to acheive this. It seems as of now I should specify them as seperate options like... parser.add_option(-o', dest=exe_file...) parser.add_option(-oexe', dest=exe_file...) parser.add_option(-otxt', dest=txt_file...) parser.add_option(-opdf', dest=pdf_file...) parser.add_option(-oppt', dest=ppt_file...) Thank you in advance. -Hiral -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, Jun 9, 2010 at 2:38 AM, Adam Tauno Williams awill...@whitemice.org wrote: On Tue, 2010-06-08 at 18:49 -0700, geremy condra wrote: On Tue, Jun 8, 2010 at 6:20 PM, Adam Tauno Williams awill...@whitemice.org wrote: On Tue, 2010-06-08 at 18:12 -0700, geremy condra wrote: * IronPython relies on the .Net environment for everything Since .Net (effectively) depends on Windows, 100% False; not effectively true at all. I run [and develop] .NET applications on LINUX every day. IL and the CLR are standards. Fine, then they can ship it with Linux too, Uhm... they do. At least in every major distro: openSUSE, Ubuntu, .. Reread my original statement. The point was that IronPython would ship with Windows (or Linux) attached to it, not the other way around. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
On 9 June, 10:35, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Nick Keighley a crit : I'm trapping mouse clicks using canvas.bind(ButtonRelease-1, mouse_clik_event) def mouse_clik_event (event) : stuff What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? Never used TkInter much, but if event is a regular Python object, you don't need any user-data field - just set whatever attribute you want, ie: [...] class Event(object): pass ... e = Event() e.user_data = here are my data e.user_data 'here are my data' But I fail to see how this would solve your problem here - where would you set this attribute ??? Those other GUIs also give you a mechanism to pass the data. Say another parameter in the bind call Or am I reduced to using spit global data? A Singleton is just Global Data by other means. from functools import partial data = dict() def handle_event(event, data): ... data['foo'] = bar ... print event ... p = partial(handle_event, data=data) ah! the first time I read this I didn't get this. But in the mean time cobbled something together using lambda. Is partial doing the same thing but a little more elegantly? p(e) __main__.Event object at 0xb75383ec data {'foo': 'bar'} Note that data doesn't have to be global here. # callback for mouse click event def mouse_clik_event (event, data) : dosomething (event.x, event.y, data) draw_stuff (display, data) data = Data(6.0, 0.2, 0.3) draw_stuff (display, data) # snag mouse display.canvas.bind(ButtonRelease-1, lambda event: mouse_clik_event (event, mandelbrot)) -- There are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns -- the ones we don't know we don't know. -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
Note, I said REPLY-ALL'. By default a simple reply goes to the individual, and not to the list. Make sure python-list@python.org is in your TO: list. I'm sending this back to the list, with my remarks at the end, since top-posting is inconsistent and confusing. madhuri vio wrote: yea i have deleted all the files related to dat module and now when i try to execute it ,,it says python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter ImportError: No module named tkinter and it has already been installed... so i was wondering if there was any other way of importing tkinter module and where am i wrong..i am stuck;( On Wed, Jun 9, 2010 at 3:03 PM, Dave Angel da...@ieee.org wrote: snip Two questions: 1) what version of Python ? You're using the version 3 capitalization. Might you have version 2.x of Python installed? Tkinter has been renamed to tkinter in Python 3.0 import sys print sys.version 2) where is tkinter installed, and is it the right place for this instance of python? You can see your Python's search path with the following: import sys print sys.path Generally, standard libraries are installed in the lib directory, and 3rd party libraries are installed in site-packages. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: optparse: best way
hiral wrote: On Jun 8, 3:03 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: hiralwrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option(-oexe', dest=exe_file...) parser.add_option(-otxt', dest=txt_file...) parser.add_option(-opdf', dest=pdf_file...) parser.add_option(-oppt', dest=ppt_file...) The above way is the most simple way to parser options. Can you please suggest any other best way / optimized way to parse these kind of options. Thank you in advance. Here's a solution: import optparse class Process: PREFIX = 'dispatch_' @staticmethod def undef(): print 'unsupported file type' @staticmethod def dispatch_exe(): print 'Hello exe file !' def dispatchFileType(option, opt, value, parser): Called by the parser, -o option. # call the corresponding method in the process method getattr(Process, Process.PREFIX + value, Process.undef)() parser = optparse.OptionParser() parser.add_option(-o, --output-fileType, type=string, action=callback, callback=dispatchFileType) options, args = parser.parse_args() Cheers, JM- Hide quoted text - - Show quoted text - Hi JM, Here it gives... $ python above_script.py -oexe abc Hello exe file ! {'output_fileType': None} # print options ['abc'] # print args In my case I require to have 'options' to consume 'abc' like... {'output_fileType': 'abc'} Thank you. use python above_script.py -o exe abc and change the dispatch function to def dispatchFileType(option, opt, value, parser): Called by the parser, -o option. # call the corresponding method in the process method for item in value.split(): getattr(Process, Process.PREFIX + item, Process.undef)() Regards, JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Replace in large text file ?
On Jun 6, 7:27 am, Steve vvw...@googlemail.com wrote: On 5 June, 08:53, Steve vvw...@googlemail.com wrote: I am new to Python and am wanting to replace characters in a very large text file.6 GB In plain language what I wish to do is: Remove all comma's Replace all @ with comma's Save as a new file. Any of you clever people know the best way to do this..idiot guide please. Thanks Steve Many thanks for your suggestions. sed -i 's/Hello/hello/g' file Run twice on the CL..with the hello's changed for my needs did it in a few minutes , Again thanks Steve Hi Steve, You can do... sed s/,//g your_file | sed s/@/,/g new_file Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
1)2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] 2) import sys print sys.path ['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/usr/local/lib/python2.6/dist-packages'] On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'. By default a simple reply goes to the individual, and not to the list. Make sure python-list@python.org is in your TO: list. I'm sending this back to the list, with my remarks at the end, since top-posting is inconsistent and confusing. madhuri vio wrote: yea i have deleted all the files related to dat module and now when i try to execute it ,,it says python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter ImportError: No module named tkinter and it has already been installed... so i was wondering if there was any other way of importing tkinter module and where am i wrong..i am stuck;( On Wed, Jun 9, 2010 at 3:03 PM, Dave Angel da...@ieee.org wrote: snip Two questions: 1) what version of Python ? You're using the version 3 capitalization. Might you have version 2.x of Python installed? Tkinter has been renamed to tkinter in Python 3.0 import sys print sys.version 2) where is tkinter installed, and is it the right place for this instance of python? You can see your Python's search path with the following: import sys print sys.path Generally, standard libraries are installed in the lib directory, and 3rd party libraries are installed in site-packages. DaveA -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'. By default a simple reply goes to the individual, and not to the list. Make sure python-list@python.org is in your TO: list. I'm sending this back to the list, with my remarks at the end, since top-posting is inconsistent and confusing. madhuri vio wrote: yea i have deleted all the files related to dat module and now when i try to execute it ,,it says python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter ImportError: No module named tkinter and it has already been installed... so i was wondering if there was any other way of importing tkinter module and where am i wrong..i am stuck;( On Wed, Jun 9, 2010 at 3:03 PM, Dave Angel da...@ieee.org wrote: snip Two questions: 1) what version of Python ? You're using the version 3 capitalization. Might you have version 2.x of Python installed? Tkinter has been renamed to tkinter in Python 3.0 import sys print sys.version On Wed, Jun 9, 2010 at 3:30 AM, madhuri vio madhuri@gmail.com wrote: 1)2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] In that case: import Tkinter NOT: import tkinter Capitalization is crucial. Cheers, Chris -- Top-posting makes everything screwy. http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
madhuri vio wrote: 1)2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] So you've got the wrong name for Tkinter. In version 2.x, you need import Tkinter 2) import sys print sys.path ['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/usr/local/lib/python2.6/dist-packages'] You still haven't said where the installation is. But at least now you know you should be looking for Tkinter.py rather than tkinter.py snip -- http://mail.python.org/mailman/listinfo/python-list
The Python computer language.
http://123maza.com/25/rani481/ -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
thankyou so much ..i made it finally... how do i make buttons and i want a lil text to label the buttons also On Wed, Jun 9, 2010 at 4:07 PM, Chris Rebert c...@rebertia.com wrote: On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'. By default a simple reply goes to the individual, and not to the list. Make sure python-list@python.org is in your TO: list. I'm sending this back to the list, with my remarks at the end, since top-posting is inconsistent and confusing. madhuri vio wrote: yea i have deleted all the files related to dat module and now when i try to execute it ,,it says python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter ImportError: No module named tkinter and it has already been installed... so i was wondering if there was any other way of importing tkinter module and where am i wrong..i am stuck;( On Wed, Jun 9, 2010 at 3:03 PM, Dave Angel da...@ieee.org wrote: snip Two questions: 1) what version of Python ? You're using the version 3 capitalization. Might you have version 2.x of Python installed? Tkinter has been renamed to tkinter in Python 3.0 import sys print sys.version On Wed, Jun 9, 2010 at 3:30 AM, madhuri vio madhuri@gmail.com wrote: 1)2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] In that case: import Tkinter NOT: import tkinter Capitalization is crucial. Cheers, Chris -- Top-posting makes everything screwy. http://blog.rebertia.com -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
yea i was able to import by capitalizing t...thank u so much but wats the reason behind they just changed it for the significance of each version ..is it that way? On Wed, Jun 9, 2010 at 4:09 PM, Dave Angel da...@ieee.org wrote: madhuri vio wrote: 1)2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] So you've got the wrong name for Tkinter. In version 2.x, you need import Tkinter 2) import sys print sys.path ['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/var/lib/python-support/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/var/lib/python-support/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode', '/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode', '/usr/local/lib/python2.6/dist-packages'] You still haven't said where the installation is. But at least now you know you should be looking for Tkinter.py rather than tkinter.py snip -- madhuri :) -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
On Wed, Jun 9, 2010 at 4:07 PM, Chris Rebert c...@rebertia.com wrote: On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'. By default a simple reply goes to the individual, and not to the list. Make sure python-list@python.org is in your TO: list. I'm sending this back to the list, with my remarks at the end, since top-posting is inconsistent and confusing. madhuri vio wrote: yea i have deleted all the files related to dat module and now when i try to execute it ,,it says python madhu.py Traceback (most recent call last): File madhu.py, line 4, in module import tkinter ImportError: No module named tkinter and it has already been installed... so i was wondering if there was any other way of importing tkinter module and where am i wrong..i am stuck;( On Wed, Jun 9, 2010 at 3:03 PM, Dave Angel da...@ieee.org wrote: snip Two questions: 1) what version of Python ? You're using the version 3 capitalization. Might you have version 2.x of Python installed? Tkinter has been renamed to tkinter in Python 3.0 import sys print sys.version On Wed, Jun 9, 2010 at 3:30 AM, madhuri vio madhuri@gmail.com wrote: 1) 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] In that case: import Tkinter NOT: import tkinter Capitalization is crucial. On Wed, Jun 9, 2010 at 3:44 AM, madhuri vio madhuri@gmail.com wrote: thankyou so much ..i made it finally... how do i make buttons and i want a lil text to label the buttons also Read a tutorial. Here's one I found: http://www.pythonware.com/library/tkinter/introduction/ Google is also your friend. Regards, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Replace in large text file ?
On 06/09/2010 05:27 AM, hiral wrote: On Jun 6, 7:27 am, Stevevvw...@googlemail.com wrote: On 5 June, 08:53, Stevevvw...@googlemail.com wrote: Remove all comma's Replace all @ with comma's Save as a new file. Many thanks for your suggestions. sed -i 's/Hello/hello/g' file Run twice on the CL..with the hello's changed for my needs did it in a few minutes , You can do... sed s/,//gyour_file | sed s/@/,/g new_file No need to use 2 sed processes: sed 's/,//g;y/@/,/' your_file new_file (you could use s/@/,/g as well, but the internal implementation of the transliterate y should be a lot faster) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
On 9 June 2010 11:44, madhuri vio madhuri@gmail.com wrote: thankyou so much ..i made it finally... how do i make buttons and i want a lil text to label the buttons also You might want to run through http://www.pythonware.com/library/tkinter/introduction/. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
You're still top-posting. Put your response either directly after the part you're responding to, or at the end. And of course, trim out the irrelevant parts (which I've been frequently criticized for failing to do) madhuri vio wrote: yea i was able to import by capitalizing t...thank u so much but wats the reason behind they just changed it for the significance of each version ..is it that way? I'm sorry, but I don't understand the phrase the significance of each version. Python 3 changed a number of things to try to bring symmetry to the language and the libraries. The most significant changes were the print statement and unicode, but there were a number of other changes, and I don't know all the rationales. In this case, the naming convention for modules is all lower-case, and the naming convention for classes is a leading capital. I usually advise people that are using Python 2.x to avoid using training materials oriented towards Python 3, as these confusions happen pretty often. DaveA Remainder snipped, since it's now out of order -- http://mail.python.org/mailman/listinfo/python-list
Re: help me
On 9 June 2010 11:47, madhuri vio madhuri@gmail.com wrote: yea i was able to import by capitalizing t...thank u so much but wats the reason behind they just changed it for the significance of each version ..is it that way? PEP 8 (http://www.python.org/dev/peps/pep-0008/) suggests that module names be lower case. Python 3 was an opportunity to make non-backwardly compatible fixes, including to the standard library. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Since I started this thread, I feel a sense of responsibility for it, in some bizarre way. Not to prolong its existence, which is clearly a troubling one for some, but to try to steer it towards some kind of consensus that will irritate the least number of people. Or better, that will gain some kind of support and momentum so that something happens. And since I have neither a reputation to lose, nor any great fondness for most of the proposed solutions, I will try to summarise some of the points made as impartially as I can. And I will add my own opinions; but a group as sophisticated as this will be able to spot them... 1 Although a few advocates of Tkinter have spoken in favour of it, most seem to think that: It's not particularly elegant, either in its use or its implementation with Tcl/Tk If we didn't have a GUI in the distribution, we wouldn't choose Tkinter now; it seems like its inclusion is a sort of historical accident. It may be all right for small projects, but once things get bigger, you have to throw away what you've done and use something else. Not many people use it anyway, so why bother? 2 Most people who have used a GUI have some investment in it. So arguments about which one is best tend to be partial and not wonderfully constructive. Indeed, about the only common thread that comes out seems to be a general dislike of Tkinter. 3 There is a surprising number of people who think that Python shouldn't have any 'favoured' association with a GUI at all. I find that surprising because of my own experience: I have written a few hundred Python programs over the last few years, mostly small and almost entirely for my own benefit. Most of those don't use a GUI. But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? 4 Some think that including any sort of GUI is 'bad'. People can choose the one they want from the large list available. I certainly don't want to stop people doing what they want. However many people have neither the time or the expertise to decide, and the experience of choosing the wrong one is a real turn-off. That, in my opinion, is where a replacement for Tkinter should be aimed: the beginning graphics programmer. But if it is built on the right foundation (which Tkinter seems not to be), it could be extended to cover far more useful cases than Tkinter can. 5 I should stop pontificating, and write code. If it's better than the existing, people will use it and it will become the standard. I don't think so. Even vast libraries of well-written code haven't become the standard. I seem to remember a DEC assembler manual from the last century, which said A standard doesn't have to be optimal, it just has to be standard (Feel free to correct me on that one. The last century seems like a long time ago). So I think comments like the system doesn't work like that - nothing happens till code is working miss the point. We are not talking about some vital but complex module or library here - it's more important than that. We are talking about the thing that the rest of the world sees as Python's biggest missing piece - the thing that beginning programmers look for and don't find - a decent, well- supported and elegant GUI. And who are the beginning programmers going to turn into? If we do our stuff right, Python programmers. If not, Java or PHP or Visual Basic programmers. Or website designers. Or worse (is there a worse?). So, to summarise the summary: I reiterate my call. Somebody has to get Tkinter out of the distribution and replaced by something that - as a minimum - doesn't get slagged off by nearly everyone. It can't be me - I don't have the clout. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, 2010-06-09 at 04:16 -0700, ant wrote: Since I started this thread, I feel a sense of responsibility for it, in some bizarre way. Not to prolong its existence, which is clearly a troubling one for some, but to try to steer it towards some kind of consensus that will irritate the least number of people. Or better, that will gain some kind of support and momentum so that something happens. The way to build support and momentum is to create a project, commit some code, and demonstrate that it solves the proposed problem. If it does, and the problem is real, then it will get support. 5 I should stop pontificating, and write code. If it's better than the existing, people will use it and it will become the standard. +1, for whatever standard means. So I think comments like the system doesn't work like that - nothing happens till code is working miss the point. No. that *is* the point. We are not talking about some vital but complex module or library here Yes, you are. A GUI toolkit is at least complex, inherently. Doubly so [exponentially so?] if you are talking about a cross-platform toolkit that is in anyway comprehensive. So, to summarise the summary: I reiterate my call. Somebody has to get Tkinter out of the distribution and replaced by something that - as a minimum - doesn't get slagged off by nearly everyone. It can't be me - I don't have the clout You get clout, whatever that means, by writing code. This isn't the senate, it is Open Source. -- Adam Tauno Williams awill...@whitemice.org LPIC-1, Novell CLA http://www.whitemiceconsulting.com OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax problem - cannot solve it by myself
On Wed, 2010-06-09, Deadly Dirk wrote: On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: Unless you have a clear need for 3rd party libraries that currently don't have 3.x versions, starting with Python 3 isn't a bad idea. But see below. From what I see, most of the people are still using Python 2.x. My reason for learning Python is the fact that my CTO decided that the new company standard for scripting languages will be Python. Not a bad choice. I've been using Perl for 15 years and it was completely adequate but, apparently, Perl is no longer in. I hope your CTO still lets you use Perl for the things Perl does better (like quickly and elegantly parse huge text files, and various one-liners). For many other tasks, I think you will quickly find Python superior. I am afraid that Python3 is like Perl 6, the one with Parrot: everybody is reading articles about it but nobody is using it. It seemed like that for a year or two (when people regularly called it Python 3000). Now it's in use -- although perhaps not so much as you would think when you read comp.lang.python. I am still perfectly happy with Python 2.4 and 2.5. These are the versions which are installed by default in modern, recent Linux distributions. I bet it will be years before Python 3 replaces them. /Jorgen -- // Jorgen Grahn grahn@ Oo o. . . \X/ snipabacken.se O o . -- http://mail.python.org/mailman/listinfo/python-list
Re: Python + vim + spaces vs tab
Robin Becker wrote: On 07/06/2010 22:18, Hans Mulder wrote: Jean-Michel Pichavant wrote: Hello, Does anyone knows a way to configure vim so it automatically select to correct expandtab value depending on the current buffer 'way of doing' ? I need to edit different files, some are using spaces, others tabs. Those belong to different projects, and changing all spaces to tabs is not an option for me. I can't make vim automatically comply with the current buffer coding style, anyone knows if it is possible ? If you can't get vim to automatically recognize the different styles you have to work with, then you could look into adding a modeline to each file. Typing :help modeline in vim will tell you how they work. Adding such a line to each and every file may be a bit of work, and you may have to convince other people working on the project that explicit is better than implicit. -- HansM I use the following at the end of my vimrc [snip] the idea is to switch between using tabs and spaces depending on the original source. If the input is all spaces we switch to tabs internally and then convert on output. If it was tabbed we keep that, if mixed I think it keeps that. This works for me as I often work with long latency connections and prefer tabs to spaces. Thanks, this is no exactly what I needed, but from your code I managed to write something that suits me. It basically counts the occurrence of tabs and 4-spaces at the beginning of lines, and use the greatest number as criterion for setting tab or space mode Something usefull is to get also the current mode in the status bar. Because of my poor knowledge of the vim scripting language I sometimes had to switch to python, but I guess it won't bother anyone in this list :) set statusline=%t\ %y\ format:\ %{ff};\ %{Statusline_expandtab()}\ [%c,%l] function! Statusline_expandtab() if expandtab == 0 return ind:tabs else return ind:space endif endfunction autocmd BufAdd,BufFilePost,BufReadPost,FileReadPost,FilterReadPost *.py,*.pyw,PYTHON;python call s:guessType() function! WordCount(word) python EOF import vim import re word = vim.eval(a:word) txt = '\n'.join(vim.current.buffer[:]) match = re.findall(word, txt) count = len(match) vim.command(let l:_count=%s % count) EOF return l:_count endfunction function! s:guessType() let _tab = WordCount('\n\t') let _space = WordCount('\n') if _tab _space set noexpandtab else set expandtab endif endfunction -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
ant wrote: Most of those don't use a GUI. But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? In the industry, most of the people knows how to use a comand line. In my company, 99% of the applications written in python have no GUI at all. 1% being web interfaces anyway. Developing maintining a GUI has a tremendous cost compared to the command line, for a small benifit. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Python + vim + spaces vs tab
On Mon, 2010-06-07, Neil Cerutti wrote: On 2010-06-07, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Hello, Does anyone knows a way to configure vim so it automatically select to correct expandtab value depending on the current buffer 'way of doing' ? I need to edit different files, some are using spaces, others tabs. Those belong to different projects, and changing all spaces to tabs is not an option for me. I can't make vim automatically comply with the current buffer coding style, anyone knows if it is possible ? :h filetypes will get you started on the right path. It'll be up to you to program the recognition logic. Do you have a heuristic in mind? You will be better off converting tabbed files to be tabless, which is pretty easy in vim. But as he wrote, that is not an option. And I can believe that -- if you are many programmers, working in parallel on some fairly big and mature project, the *last* thing you want is someone coming in and reindenting everything. /Jorgen -- // Jorgen Grahn grahn@ Oo o. . . \X/ snipabacken.se O o . -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
Nick Keighley a écrit : On 9 June, 10:35, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Nick Keighley a crit : I'm trapping mouse clicks using canvas.bind(ButtonRelease-1, mouse_clik_event) def mouse_clik_event (event) : stuff What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? Never used TkInter much, but if event is a regular Python object, you don't need any user-data field - just set whatever attribute you want, ie: [...] class Event(object): pass ... e = Event() e.user_data = here are my data e.user_data 'here are my data' But I fail to see how this would solve your problem here - where would you set this attribute ??? Those other GUIs also give you a mechanism to pass the data. Say another parameter in the bind call Ok, so my suggestion should work, as well as any equivalent (lambda, closure, custom callable object etc). from functools import partial data = dict() def handle_event(event, data): ... data['foo'] = bar ... print event ... p = partial(handle_event, data=data) ah! the first time I read this I didn't get this. But in the mean time cobbled something together using lambda. Is partial doing the same thing Mostly, yes - in both cases you get a callable object that keeps a reference on the data. You could also use a closure: def make_handler(func, data): def handler(event): func(event, data) return handler def mouse_clik_event (event, data) : dosomething (event.x, event.y, data) draw_stuff (display, data) display.canvas.bind( ButtonRelease-1, make_handler(mouse_click_event, data) ) but a little more elegantly? Depending on your own definition for elegantly... Note that the lambda trick you used is very idiomatic - functool.partial being newer and probably not as used - so one could argue that the most common way is also the most elegant !-) -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
On 9 June, 13:50, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Nick Keighley a écrit : On 9 June, 10:35, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Nick Keighley a crit : I'm trapping mouse clicks using canvas.bind(ButtonRelease-1, mouse_clik_event) def mouse_clik_event (event) : stuff What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? Never used TkInter much, but if event is a regular Python object, you don't need any user-data field - just set whatever attribute you want, ie: [...] class Event(object): pass ... e = Event() e.user_data = here are my data e.user_data 'here are my data' But I fail to see how this would solve your problem here - where would you set this attribute ??? Those other GUIs also give you a mechanism to pass the data. Say another parameter in the bind call Ok, so my suggestion should work, as well as any equivalent (lambda, closure, custom callable object etc). from functools import partial data = dict() def handle_event(event, data): ... data['foo'] = bar ... print event ... p = partial(handle_event, data=data) ah! the first time I read this I didn't get this. But in the mean time cobbled something together using lambda. Is partial doing the same thing Mostly, yes - in both cases you get a callable object that keeps a reference on the data. You could also use a closure: def make_handler(func, data): def handler(event): func(event, data) return handler def mouse_clik_event (event, data) : dosomething (event.x, event.y, data) draw_stuff (display, data) display.canvas.bind( ButtonRelease-1, make_handler(mouse_click_event, data) ) but a little more elegantly? Depending on your own definition for elegantly... Note that the lambda trick you used is very idiomatic - functool.partial being newer and probably not as used - so one could argue that the most common way is also the most elegant !-) I'm somewhat newbie at Python but I'd seen lambda elsewhere (scheme). I like the closure trick... I'm using Python In a Nutshell as my guide. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 09 Jun 2010 06:05:43 GMT Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: I think the only way to end this pointless discussion is this: Hitler would have loved Tkinter! Sorry, Quirk's Exception to Godwin's Law says that you can't invoke Godwin's Law on purpose. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
Nick Keighley a écrit : On 9 June, 13:50, Bruno Desthuilliers bruno. (snip) Note that the lambda trick you used is very idiomatic - functool.partial being newer and probably not as used - so one could argue that the most common way is also the most elegant !-) I'm somewhat newbie at Python but I'd seen lambda elsewhere (scheme). I like the closure trick... Well... Python is not Scheme - specially wrt/ lambdas and closures. While it has some restricted support for some FP idioms, Python is definitly an OO language. FWIW, you could implement the functool.partial class using closures / HOF (and it's been done before), but it's easier and just more obvious to take the OO route here. -- http://mail.python.org/mailman/listinfo/python-list
Re: sir
On Wed, 9 Jun 2010 14:24:50 +0530 madhuri vio madhuri@gmail.com wrote: sir i am wanted to know more in detail about expressions ..if u can give an abstract idea... Please read this before posting again. http://www.catb.org/~esr/faqs/smart-questions.html -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 06/09/10 14:37, D'Arcy J.M. Cain wrote: On 09 Jun 2010 06:05:43 GMT Steven D'Apranosteve-remove-t...@cybersource.com.au wrote: I think the only way to end this pointless discussion is this: Hitler would have loved Tkinter! Sorry, Quirk's Exception to Godwin's Law says that you can't invoke Godwin's Law on purpose. How about a meta/meta reference if the poster would apologize now with 'Ich habe es nicht gewusst' ? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Python + vim + spaces vs tab
On 09/06/2010 13:06, Jean-Michel Pichavant wrote: the idea is to switch between using tabs and spaces depending on the original source. If the input is all spaces we switch to tabs internally and then convert on output. If it was tabbed we keep that, if mixed I think it keeps that. This works for me as I often work with long latency connections and prefer tabs to spaces. Thanks, this is no exactly what I needed, but from your code I managed to write something that suits me. It basically counts the occurrence of tabs and 4-spaces at the beginning of lines, and use the greatest number as criterion for setting tab or space mode Something usefull is to get also the current mode in the status bar. Because of my poor knowledge of the vim scripting language I sometimes had to switch to python, but I guess it won't bother anyone in this list :) set statusline=%t\ %y\ format:\ %{ff};\ %{Statusline_expandtab()}\ [%c,%l] function! Statusline_expandtab() .. I'm not exactly an expert at vim programming either :( nice idea to show the mode in the status. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: Syntax problem - cannot solve it by myself
On Wed, 09 Jun 2010 02:45:36 +, Deadly Dirk wrote: On Tue, 08 Jun 2010 18:52:44 -0700, alex23 wrote: Unless you have a clear need for 3rd party libraries that currently don't have 3.x versions, starting with Python 3 isn't a bad idea. From what I see, most of the people are still using Python 2.x. My reason for learning Python is the fact that my CTO decided that the new company standard for scripting languages will be Python. I've been using Perl for 15 years and it was completely adequate but, apparently, Perl is no longer in. I am afraid that Python3 is like Perl 6, the one with Parrot: everybody is reading articles about it but nobody is using it. If the CTO is seting Python as company standard he should also be specifying which version! even without the BIG changes between 2.XX 3.XX not specifying a version could lead to trouble. -- Sometimes when I get up in the morning, I feel very peculiar. I feel like I've just got to bite a cat! I feel like if I don't bite a cat before sundown, I'll go crazy! But then I just take a deep breath and forget about it. That's what is known as real maturity. -- Snoopy -- http://mail.python.org/mailman/listinfo/python-list
Re: sir
On Wed, 9 Jun 2010 09:50:18 -0400 D'Arcy J.M. Cain da...@druid.net wrote: On Wed, 9 Jun 2010 14:24:50 +0530 madhuri vio madhuri@gmail.com wrote: sir i am wanted to know more in detail about expressions ..if u can give an abstract idea... Please read this before posting again. http://www.catb.org/~esr/faqs/smart-questions.html Apologies to the list. I did Reply but it went to the list instead of the sender even though there was no Reply-To header. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter help - Why this behavior ? (py3)
Le 07/06/2010 15:26, Alf P. Steinbach a écrit : * Dodo, on 07.06.2010 12:38: Le 05/06/2010 19:07, Alf P. Steinbach a écrit : * Dodo, on 05.06.2010 15:46: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop() def op(self): Second(self) print(print) class Second: def __init__(self, parent): root = Toplevel(parent.root) root.grab_set() root.mainloop() First() when I close the second window, the print is NOT executed. It's done when I close the first window. Why do it freeze my function? First, sorry about Thunderbird 3.x messing up the quoting of the code. Don't know what they did to introduce all those bugs, but anyway, Thunderbird 3.x is an example that even seasoned programmers introduce an unbelievable number of bugs, I think mostly just by repeating code patterns blindly. In your code above you're doing as the TB programmers presumably did, repeating a code pattern that you've seen has worked, without fully grokking it. The call to 'mainloop' enters a loop. A button press causes your callback to be invoked from within that loop, but your code then enters a new 'mainloop'. Don't. Except for modal dialogs the single top level 'mainloop' suffices (all it does is to dispatch messages to handlers, such as your button press callback). So, just place a single call to 'mainloop' at the end of your program. Remove the calls in 'First' and 'Second'. How do I create custom modal dialogs then? I typed tkinter modal dialog in the Firefox address bar, and it landed me on http://effbot.org/tkinterbook/tkinter-dialog-windows.htm Cheers hth., - Alf Thanks, I don't know why I didn't find effbot.org on the first place. But I __did__ googled about modal dialogs! .wait_window() works great Thanks for your time, Dorian -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
I'll venture to say that the path of least resistance (which includes little or modest development effort) would be for Python to retain Tkinter in the way it does now, but have Tkinter GUI's magically appear less horrid. Guess what? That's already happened. Newer versions of Tk (which Tkinter uses internally of course) do look much better. But, there are a few small API changes you'd need to make to Tkinter programs to see that improvement. You can find these changes and improvements talked about at http://www.tkdocs.com I can pretty much guarantee that continuing to share information about these new things in Tkinter, and keeping up with modern versions of Tk, is a whole lot less work than the massive engineering efforts people are talking about as alternatives. (Not to say the end results, if they were ever completed, wouldn't be better going a different way...) Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, Jun 9, 2010 at 4:16 AM, ant shi...@uklinux.net wrote: We are talking about the thing that the rest of the world sees as Python's biggest missing piece Citation needed, or its just hyperbole. - the thing that beginning programmers look for and don't find - a decent, well- supported and elegant GUI. Doesn't exist anywhere, in any platform, in any language, in any environment. The only ones who ever got even slightly close where proprietary -- Delphi was about the best elegant and simple (and yet, comprehensive) UI platform I think. Mac's actually have a lot of promise in UI design and integration, but then the poor newbie has to learn Objective-C :) And of course, Visual Studio. You keep saying Visual Basic: meh. These days, its .NET that's the platform there, not Visual Basic. Or Visual C++. Given ten years of work, and you might be able to get a system that fulfills your requirements. I doubt it. You'll need a pretty significant budget, or, a LOT of VERY motivated volunteers. And that's sort of the point-- what you're not getting from this thread: its not that most people fall under your paraphrased POV's of 1-4. Its that most people fall under, meh, I don't really care in the end. I got an opinion, but I don't really care. I'm content with the status quo. And who are the beginning programmers going to turn into? They'll turn to the same things we do. And have a learning curve: ALL gui programming is fundamentally slightly painful when you first start it, its just a fact of life. You suddenly have to start thinking in a different way. Especially if you want your GUI to actually not-suck, to be cross-platform, and to be able to grow into an advanced and capable GUI in the future. So, to summarise the summary: I reiterate my call. Somebody has to get Tkinter out of the distribution and replaced by something that - as a minimum - doesn't get slagged off by nearly everyone. It can't be me - I don't have the clout. Nobody has the clout. Guido may have had the clout to remove tkinter in Python 3.0: that didn't happen, so maybe in a decade for Python 4k you can propose it again. But not even Guido has the clout to see a 'decent replacement' gets made. There is too little motivation. Too few serious and capable people are interested in the entire idea. Not because they are 'invested' in an existing platform: but because either they don't do GUI programming at all (this is NOT that significant of a minority), or because they need a -complete- and fully-functional GUI (which is a HUGE massive project and debatably can't be done right-- and which PyQT and wxPython fulfill at least sorta okay enough for them), or because Tkinter really is good enough for them or they like it. You have one thread in a mailing list and from it you're interpreting, Everyone hates it. Its simply not true. A lot of people actually use it. And are quite satisfied with it. It has a 'quick and dirty' quality which makes it useless for me-- I need polish-- but for some uses, its entirely suitable. There is a level of Reality, meet tkinter-replacement-wanting-people that seriously needs to happen. --S -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
bart.c ba...@freeuk.com wrote: Grant Edwards inva...@invalid.invalid wrote in message Since Tk already provides a basic GUI toolset, and Python can interface with it more directly than it can with other toolkits (PyGui - PyGtk - Gtk - Xlib), Compare that to this: TkInter - Tcl - Tk - Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton -) Tkinter-API - Xlib ? The Tk library was not built as a straight C/C++ library that interfaces to Xlib (or the Windows or Mac libraries), with a Tcl binding on top of that. Tk was built expressly as a GUI toolkit for Tcl, and it uses Tcl very extensively throughout its implementation. While there is a C API, it does not expose anywhere close to everything you'd need without making calls to the Tcl interpreter. Whether you consider this a good or bad thing, that's the way it is. So removing Tcl from the Tk library is not by any means practical. Of the dozens of dynamic languages with Tk bindings, almost all interface to Tk through the Tcl interface. The one notable exception is PerlTk, which went out of its way to extract Tcl from Tk, a herculean effort. Though they managed, maintaining it was virtually impossible, so they are stuck with a 15+ year old version of Tk, taking into account none of the improvements made during that time. The preferred Perl interface to Tk is a newer one called pTk, which wraps Tk's Tcl API, meaning it can easily keep up to date with improvements in Tk. And the wrapper code itself is frighteningly small, what amounts to an exceedingly clever but minor engineering effort. I hope this explains why trying to have Tkinter work without Tcl would be a non-starter. Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: passing data to Tkinter call backs
On Jun 9, 4:23 am, Nick Keighley nick_keighley_nos...@hotmail.com wrote: What mouse_clik_event does is modify some data and trigger a redraw. Is there any way to pass data to the callback function? Some GUIs give you a user-data field in the event, does Tkinter? I don't know how you're triggering redraws but you need to read this first... w.update() This method forces the updating of the display. It should be used only if you know what you're doing, since it can lead to unpredictable behavior or looping. It should never be called from an event callback or a function that is called from an event callback. w.update_idletasks() Some tasks in updating the display, such as resizing and redrawing widgets, are called idle tasks because they are usually deferred until the application has finished handling events and has gone back to the main loop to wait for new events. If you want to force the display to be updated before the application next idles, call the w.update_idletasks() method on any widget. -- http://mail.python.org/mailman/listinfo/python-list
[py3] Tkinter menu checkbutton not working
Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label=My checkbutton, variable=self.ck, command=self.displayCK) self.menu.add_cascade(label=sub, menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() The self.ck will always be 0... why? Dorian -- http://mail.python.org/mailman/listinfo/python-list
Re: if, continuation and indentation
HH henri...@gmail.com writes: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. There are several good suggestions for formatting but no-one has mentioned rewriting the code. Use a boolean variable to hold the result of the condition and then the if statement is more readable. -- Pete Forman-./\.- West Sussex, UK -./\.- http://petef.22web.net -./\.- petef4+use...@gmail.com -./\.- -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Wed, 2010-06-09 at 04:16 -0700, ant wrote: Since I started this thread, I feel a sense of responsibility for it, in some bizarre way. I'm glad you brought this GUI subject up. I've enjoyed reading everyones thoughts on this subject. Most people who have used a GUI have some investment in it. So arguments about which one is best tend to be partial and not wonderfully constructive. I'm just frustrated at the moment since I don't know which one to choose. Looks like there's a lot of choices and I need to spend a lot of time testing each of them out - and each has it's own learning curve. But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? I would agree. When writing code for my customers, they want a very intuitive and simple application. GUI is perfect for this instead of having to include flags and path strings in the command-line. However many people have neither the time or the expertise to decide, and the experience of choosing the wrong one is a real turn-off. Yeah, I definitely agree! That, in my opinion, is where a replacement for Tkinter should be aimed: the beginning graphics programmer. But if it is built on the right foundation (which Tkinter seems not to be), it could be extended to cover far more useful cases than Tkinter can. I haven't been able to test pyGUI just yet. From reading about it, it looks pretty hopeful. I need to install an earlier OS X version since I can't seem to get it to work on Snow Leopard. Jay -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter help - Why this behavior ? (py3)
On Jun 5, 8:46 am, Dodo dodo_do_not_wake...@yahoo.fr wrote: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop() def op(self): Second(self) print(print) class Second: def __init__(self, parent): root = Toplevel(parent.root) root.grab_set() root.mainloop() Please don't write code like this, it is very, very, very, very ugly. Python is an OOP language do use that to your advantage and you will make your life much easier! Here is a better alternative. import Tkinter as tk from Tkconstants import * import tkSimpleDialog class MyDialog(tkSimpleDialog.Dialog): def body(self, master): prompt = Hello from my custom dialog!\nAlthough with something this simple i should have used tkMessageBox. tk.Label(self, text=prompt).pack() def validate(self): print 'I need to put some code here, maybe' return True def apply(self): print 'I need to put some code here, maybe' class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) b=tk.Button(self, text='Show Dialog', command=self.showDialog) b.pack(padx=5, pady=5) def showDialog(self): d = MyDialog(self) if __name__ == '__main__': app = App() app.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: if, continuation and indentation
Pete Forman wrote: HH henri...@gmail.com writes: I have a question about best practices when it comes to line wrapping/ continuation and indentation, specifically in the case of an if statement. There are several good suggestions for formatting but no-one has mentioned rewriting the code. Use a boolean variable to hold the result of the condition and then the if statement is more readable. It has been suggested. ;) JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter menu checkbutton not working
On Jun 9, 11:26 am, Dodo dodo_do_not_wake...@yahoo.fr wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label=My checkbutton, variable=self.ck, command=self.displayCK) self.menu.add_cascade(label=sub, menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() see my recent post on your last question. The way you are writing these classes is wrong. Always inherit from something, in this case Tk. Fix that first and then pretty up this GUI. But to answer your question self.ck needs to be an instance of tk.IntVar. Read more about it here... http://infohost.nmt.edu/tcc/help/pubs/tkinter/checkbutton.html -- http://mail.python.org/mailman/listinfo/python-list
Re: [py3] Tkinter menu checkbutton not working
On 6/9/2010 12:26 PM, Dodo wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label=My checkbutton, variable=self.ck, command=self.displayCK) self.menu.add_cascade(label=sub, menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() The self.ck will always be 0... why? You never change it ;-) Passing the *value* 0 to the widget has no effect on the binding of self.ck. You need to pass a container whose contents the widget can modify == specifically an IntVar. See 24.1.6.4. Coupling Widget Variables. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Steven D'Aprano wrote: In any case, Python doesn't ship with Tcl and Tk. They are dependencies *only if you use Tkinter*. It's not compulsory. So what do you call a fact with quark-like attributes? A quack? ;) Tcl/Tk do, in fact, ship with the Windows versions. Good reminder that they may not be there on other platforms, though. ~Ethan~ P.S. Now that I think about it, actually installing them is optional... -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter menu checkbutton not working
On Jun 9, 11:26 am, Dodo dodo_do_not_wake...@yahoo.fr wrote: snip Also you are now NOT using 8 space indention unlike your last post -- which i applaud you for. However you've gone to the opposite extreme with 2 space indention and interlaced it with one space indention, oh dear! Please use four space indention as this is the preferred and excepted way to write python code. If you plan to write code that other Python programmers see you should read the Python style guide and follow it. Heres a link http://www.python.org/dev/peps/pep-0008/ -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Gregory Ewing wrote: Kevin Walzer wrote: PyGUI ... certainly is *not* a lightweight GUI toolkit that could easily be incorporated into the Python core library--it instead has rather complex dependencies on both other GUI toolkits and Python wrappers of those toolkits. I don't see how the dependencies could be regarded as complex. There's more or less only one on each platform, and they're pretty standard accessories for the platform concerned. You could say there are two on Linux if you count gtk itself, but you almost certainly already have it these days if you're running any kind of desktop at all. *Alert* Potentially dumb question following: On the MS Windows platform, Gtk is not required, just win32? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter help - Why this behavior ? (py3)
Le 09/06/2010 18:49, rantingrick a écrit : On Jun 5, 8:46 am, Dodododo_do_not_wake...@yahoo.fr wrote: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop() def op(self): Second(self) print(print) class Second: def __init__(self, parent): root = Toplevel(parent.root) root.grab_set() root.mainloop() Please don't write code like this, it is very, very, very, very ugly. Python is an OOP language do use that to your advantage and you will make your life much easier! Here is a better alternative. import Tkinter as tk from Tkconstants import * import tkSimpleDialog class MyDialog(tkSimpleDialog.Dialog): def body(self, master): prompt = Hello from my custom dialog!\nAlthough with something this simple i should have used tkMessageBox. tk.Label(self, text=prompt).pack() def validate(self): print 'I need to put some code here, maybe' return True def apply(self): print 'I need to put some code here, maybe' class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) b=tk.Button(self, text='Show Dialog', command=self.showDialog) b.pack(padx=5, pady=5) def showDialog(self): d = MyDialog(self) if __name__ == '__main__': app = App() app.mainloop() Could you please explain to me what's the big difference? Dorian -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter menu checkbutton not working
Le 09/06/2010 18:54, rantingrick a écrit : On Jun 9, 11:26 am, Dodododo_do_not_wake...@yahoo.fr wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label=My checkbutton, variable=self.ck, command=self.displayCK) self.menu.add_cascade(label=sub, menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() see my recent post on your last question. The way you are writing these classes is wrong. Always inherit from something, in this case Tk. Fix that first and then pretty up this GUI. But to answer your question self.ck needs to be an instance of tk.IntVar. Read more about it here... http://infohost.nmt.edu/tcc/help/pubs/tkinter/checkbutton.html I already tried with self.ck = IntVar() and now it displays PY_VAR0 FYI, I'm using Thunderbird 3, which appears to have some bugs with indentation (according to Alf P. Steinbach). That's why I replaced \t by a single space -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter help - Why this behavior ? (py3)
Le 09/06/2010 19:13, Dodo a écrit : Le 09/06/2010 18:49, rantingrick a écrit : On Jun 5, 8:46 am, Dodododo_do_not_wake...@yahoo.fr wrote: Hi, let's consider this exemple : from tkinter import * from tkinter.ttk import * class First: def __init__(self): self.root = Tk() B = Button(self.root, command=self.op) B.pack() self.root.mainloop() def op(self): Second(self) print(print) class Second: def __init__(self, parent): root = Toplevel(parent.root) root.grab_set() root.mainloop() Please don't write code like this, it is very, very, very, very ugly. Python is an OOP language do use that to your advantage and you will make your life much easier! Here is a better alternative. import Tkinter as tk from Tkconstants import * import tkSimpleDialog class MyDialog(tkSimpleDialog.Dialog): def body(self, master): prompt = Hello from my custom dialog!\nAlthough with something this simple i should have used tkMessageBox. tk.Label(self, text=prompt).pack() def validate(self): print 'I need to put some code here, maybe' return True def apply(self): print 'I need to put some code here, maybe' class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) b=tk.Button(self, text='Show Dialog', command=self.showDialog) b.pack(padx=5, pady=5) def showDialog(self): d = MyDialog(self) if __name__ == '__main__': app = App() app.mainloop() Could you please explain to me what's the big difference? Dorian I think I see it now. Seems good to be -- http://mail.python.org/mailman/listinfo/python-list
Re: FIle transfer over network - with Pyro?
Thanks for all the replies. I might use http, or I utilize a separate ftp server. On Sat, 5 Jun 2010 13:34:45 -0700 geremy condra debat...@gmail.com wrote: On Sat, Jun 5, 2010 at 10:14 AM, Dan Stromberg strom...@gmail.com wrote: A more realistic answer is probably to use something based on HTTP. This solves a number of real-world problems, like the exact protocol to use over the network, and detecting network issues which cause the transfer to fail. It also has the benefit that there's plenty of libraries already written to help you out. Didn't the OP request something fast? Nope. He pointed out that pyro is not efficient and asked what libraries we would use. OP: HTTP is a reasonable choice unless you need really extreme performance. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 6:16 am, ant shi...@uklinux.net wrote: Since I started this thread, I feel a sense of responsibility for it, in some bizarre way. Not to prolong its existence, which is clearly a troubling one for some, but to try to steer it towards some kind of consensus that will irritate the least number of people. Don't worry about irritating people. There are a subset of folks on this list that await the chance to be offended just so they can spew bile. Really, don't worry about them. And never allow these minions to quell your freedom of speech, because they will try. Or better, that will gain some kind of support and momentum so that something happens. Exactly. Thats the very point that the naysayers miss. Pythons community is no field of dreams. Just because you build it, doesn't mean they'll come. Even if what you build is better, they still probably won't come, or even give a flying fig. 1 Although a few advocates of Tkinter have spoken in favour of it, most seem to think that: It's not particularly elegant, either in its use or its implementation with Tcl/Tk If we didn't have a GUI in the distribution, we wouldn't choose Tkinter now; it seems like its inclusion is a sort of historical accident. I don't think it was an accident. Guido forged the path of Tkinter's inclusion in Python. From what i understand he wrote most of Tkinter and IDLE himself! (albeit a very long time ago). This all stems from Computer Programming For Everyone. Guido had a vision, and he left that vision in our hands and we utterly failed to maintain it! It has now fallen into complete ruin. And any motivation to pull ourselves out of this rut is missing. It may be all right for small projects, but once things get bigger, you have to throw away what you've done and use something else. Not many people use it anyway, so why bother? The GUI that Python includes will never (AND SHOULD NEVER) be for winning GUI of the year contests. The sheer size of wx or others prevents their inclusion and rightly so. People need to stop using this argument because it is a moot point. The GUI must be small, pythonic, and cross platform. Used only for utility and learning purposes. 2 Most people who have used a GUI have some investment in it. So arguments about which one is best tend to be partial and not wonderfully constructive. Indeed, about the only common thread that comes out seems to be a general dislike of Tkinter. And the cycle continues... # DONT RUN THIS CODE ;-) import itertools state = itertools.cycle(['But Tkinter Sucks!', 'So Fix Tkinter!']) while arguing: ... print state.next() # DONT RUN THIS CODE ;-) 3 There is a surprising number of people who think that Python shouldn't have any 'favoured' association with a GUI at all. I find that surprising because of my own experience: I have written a few hundred Python programs over the last few years, mostly small and almost entirely for my own benefit. Most of those don't use a GUI. But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? These people are the ones who cannot change with the times. You know what they say. Change with the times or get left behind. They would rather hack together a curses front-end than to drop into a GUI, yes really. You old timers need to get with the program, GUI is here to stay until wet-ware interfaces take over. So drag yourself into the 21st century (kicking and screaming if necessary) 4 Some think that including any sort of GUI is 'bad'. People can choose the one they want from the large list available. I certainly don't want to stop people doing what they want. However many people have neither the time or the expertise to decide, and the experience of choosing the wrong one is a real turn-off. That, in my opinion, is where a replacement for Tkinter should be aimed: the beginning graphics programmer. Tkinter is aimed at the newbie and i would think that was Guido's original vision. And it's not the worst GUI by far. But we need to fix it, or abandon it. But if it is built on the right foundation (which Tkinter seems not to be), it could be extended to cover far more useful cases than Tkinter can. Agreed! 5 I should stop pontificating, and write code. If it's better than the existing, people will use it and it will become the standard. Writing code guarantee's NOTHING! That is the whole point of threads like this one. First do research and then write code. Not the other way round lest you have time to waste. I don't think so. Even vast libraries of well-written code haven't become the standard. I seem to remember a DEC assembler manual from the last century, which said A standard doesn't have to be optimal, it just has to be standard (Feel free to correct me on that one. The last century seems like a long time ago). So I think comments like the system
Re: GUIs - A Modest Proposal
On Jun 9, 2010, at 7:16 , ant wrote: 1 Although a few advocates of Tkinter have spoken in favour of it, most seem to think that: It's not particularly elegant, either in its use or its implementation with Tcl/Tk Not many people use it anyway, so why bother? 2 Most people who have used a GUI have some investment in it. So arguments about which one is best tend to be partial and not wonderfully constructive. In this whole discussion, I haven't seen anyone mention wax (http:// zephyrfalcon.org/labs/wax_primer.html) I know that it is not being supported anymore, but the philosophy is something we can get behind. I have done a fair amount of GUI programming, and from my personal experience tkinter seems a bit clunky, and there are some really annoying things (like running a program from the commandline in OS X which launches a GUI has the window appear *behind* the terminal program) which make it impractical for my personal use. Up until recently Qt had odd license issues, so I leaned toward wx which does not have a very nice python interface. Much of wax, however, is a thin wrapper around wx, and is usable even now and is much easier and much more pythonic. The nice thing about it is that, being a thin wrapper, you can have all of the power of wx if you want to. From a work-flow standpoint I often find myself doing everything in wax and then running into a part of wx that hasn't been wrapped, so I use the ugly wx code within my wax code for a while and later make the wrapper clean. I wonder if that sort of philosophy would work: a really nice and clear, pythonic wrapper around a sophisticated, complex, and complete GUI framework. It should be thin enough that the underlying GUI library can be called directly, however, or its usefulness will be greatly diminished. Depending on how it is designed, it might even be possible to have a multi-framework wrapping, so that someone could have a Qt-based wrapper, and another using the same module choose to have it wrap wx. I think the codebase for wax would be a very nice start to the discussion, because it is already almost usable. It is already very close to what I would consider an ideal GUI framework. 5 I should stop pontificating, and write code. If it's better than the existing, people will use it and it will become the standard. I guess that answers that one! :) bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
The GUI must be small, pythonic, and cross platform. And how many times have I heard that? I develop GUIs... good luck. Come back in ten years when you have some working code. Tkinter is aimed at the newbie and i would think that was Guido's original vision. And it's not the worst GUI by far. But we need to fix it, or abandon it. Or just use a different one. Simple enough. 5 I should stop pontificating, and write code. If it's better than the existing, people will use it and it will become the standard. Writing code guarantee's NOTHING! NOT writing code does guarantee NOTHING!! That is the whole point of threads like this one. First do research and then write code. Not the other way round lest you have time to waste. So I think comments like the system doesn't work like that - nothing happens till code is working miss the point. Exactly! see my last answer. A point cannot miss itself, that doesn't make sense. code is working *is* the point, the whole point, and there is no other point. So, to summarise the summary: I reiterate my call. Somebody has to get Tkinter out of the distribution and replaced Or not, whatever. by something that - as a minimum - doesn't get slagged off by nearly everyone. It can't be me - I don't have the clout. Yes we need a leader. Or we don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 12:53 pm, Brian Blais bbl...@bryant.edu wrote: On Jun 9, 2010, at 7:16 , ant wrote: 1 Although a few advocates of Tkinter have spoken in favour of it, most seem to think that: It's not particularly elegant, either in its use or its implementation with Tcl/Tk Not many people use it anyway, so why bother? 2 Most people who have used a GUI have some investment in it. So arguments about which one is best tend to be partial and not wonderfully constructive. In this whole discussion, I haven't seen anyone mention wax (http:// zephyrfalcon.org/labs/wax_primer.html) I myself would not be opposed to a thin Wx, i think it would be a step in the right direction. The project looks very interesting although i have not tried the thing out yet so i can only speak to the idea of it. The beauty is that at least you're investing your time into something that scales into professional level GUI building. Wx has a very large and up to date widget set. With Tkinter you get so far and then bang, brick wall! Your confined by even TclTk so there is no hope of escape! +1 wax -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 1:06 pm, Adam Tauno Williams awill...@whitemice.org wrote: Or just use a different one. Simple enough. Thats not even valid to this argument. Everyone IS free to choose another GUI already. Please re-read this entire thread, absorb the contents therein, ponder extensively the pros and cons, and then formulate an intelligent response. I for one would love to hear some real input from you. NOT writing code does guarantee NOTHING!! just argumentative. A point cannot miss itself, that doesn't make sense. code is working *is* the point, the whole point, and there is no other point. just argumentative. Or not, whatever. just really argumentative. Or we don't. just more of the same. Can you give us some real explanations as to why you think Tkinter... A. should be included B. should be replaced C. should be improved ...that are more than just argumentative bile? -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter menu checkbutton not working
On Jun 9, 12:20 pm, Dodo dodo_do_not_wake...@yahoo.fr wrote: Le 09/06/2010 18:54, rantingrick a crit : On Jun 9, 11:26 am, Dodododo_do_not_wake...@yahoo.fr wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.root['menu'] = self.menu self.submenu = Menu(self.menu) self.ck = 0 self.submenu.add_checkbutton(label=My checkbutton, variable=self.ck, command=self.displayCK) self.menu.add_cascade(label=sub, menu=self.submenu ) def displayCK(self): print( self.ck ) app = Window() app.root.mainloop() see my recent post on your last question. The way you are writing these classes is wrong. Always inherit from something, in this case Tk. Fix that first and then pretty up this GUI. But to answer your question self.ck needs to be an instance of tk.IntVar. Read more about it here... http://infohost.nmt.edu/tcc/help/pubs/tkinter/checkbutton.html I already tried with self.ck = IntVar() and now it displays PY_VAR0 FYI, I'm using Thunderbird 3, which appears to have some bugs with indentation (according to Alf P. Steinbach). That's why I replaced \t by a single space IntVar is a class and self.ck is an instance of that class which is a PY_VAR. Try print(dir(self.ck)) in your callback to see what methods are available to this instance. Im just speculating here but somehow there must be a way to get and set the IntVar's value... hmmm? You're about to kick yourself when you realize it. ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: is there a way to warn about missing modules *without* running python?
On Jun 5, 7:24 pm, Terry Reedy tjre...@udel.edu wrote: On 6/5/2010 9:42 AM, lkcl wrote: if someone could perhaps explain this (in a different way from me), in the context of python the programming language and python the http://python.orginterpreter;, i.e. having absolutely nothing to do withpyjamas, i would be most grateful, and it would benefit that user's understanding of python. I do not know the background of your user, but here is my try: Loading a Python module at runtime is like loading a song, picture, or web page. An import statement is like a web page link. thank you, terry - that's a good analogy. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about NNTPLib
I just had a quick look at the documentation. It looks like you should re-read it.http://docs.python.org/py3k/library/nntplib.html#nntplib.NNTP.xhdr snip Thank you for the help Thomas. I did reread the doc and I see what you mean. I think this will work now. Much thanks for the help! Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: is there a way to warn about missing modules *without* running python?
On Jun 5, 2:16 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Neither Python, nor Javascript (as far as I know -- I welcome corrections) do static linking. for the command-line versions of javascript such as spidermonkey, i believe that a keyword/function is dropped into the global namespace - load, which take one argument (a filename). in browsers, it's much more waffly: anything that is tagged as script language='javascript' gets executed in a global namespace (into which two strategically critical global variables have been dropped: window and document, which is really the only real clue that you have that this is javascript in a web browser engine, not javascript at a command-line). so, if the DOM happens to ever get modified (typically using AJAX), such that an additional node with a tag of script and an attribute language='javascript' happens to get added, the browser engine _happens_ to notice and _happens_ to execute the resultant newly-added javascript. this well-known but horribly archaic technique is about as close to dynamic module loading that you're ever likely to get in web browsers. everything else is static, so to speak, and _everything_ operates in one monster global namespace (on a per-page basis). ... but i digress :) Python modules are, conceptually speaking, like DLLs. They are loaded at runtime, not at compile time. This has many advantages over static linking, but some disadvantages as well. thank you, steve - i believe this is the crux of the matter (which terry's analogy expanded on). much appreciated the replies. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Am 09.06.2010 01:54, schrieb Grant Edwards: On 2010-06-08, Martin v. Loewismar...@v.loewis.de wrote: Am 08.06.2010 20:15, schrieb Grant Edwards: On 2010-06-08, Martin v. Loewismar...@v.loewis.de wrote: TkInter - Tcl - Tk - Xlib Is the Tcl intepreter really need to use this GUI? Why not: (Pyton -) Tkinter-API - Xlib ? Even if this was possible (which it is not) Why is it not possible? It seems to have been done for other languages. So you don't know for sure? Which implementation specifically do you think of? There was a Scheme implementation called STk that didn't use Tcl. That's not true. See, for example, Src/tk-glue.c. It contains functions like static SCM TkResult2Scheme(Tcl_Interp *interp, int objproc) { SCM res; if (objproc) { register SCM data = TCLOBJDATA((SCM) Tcl_GetObjResult(interp)); res = data ? STk_convert_tcl_list_to_scheme(data) : NIL; } else { register char *s = interp-result; res = (*s) ? STk_convert_Tcl_string2list(s) : NIL; } Tcl_ResetResult(interp); return res; } SCM STk_execute_Tcl_lib_cmd(SCM cmd, SCM args, SCM env, int eval_args) ... This looks *exactly* like the approach taken in _tkinter to me. One difference seems to be that they include the full source code of Tcl and Tk with the interpreter, so you don't need to download it separately. The other difference apparently is that they expose Tcl commands as Scheme functions, so that they can write (Tk:pack [Tk:frame w.top :relief raised :bd 1] :expand #t :fill both) However, this still uses a Tcl_Interp object during evaluation. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
But whenever I write a program that someone else is going to use, it has to have a GUI. Is that not true for most people? Most definitely not. Of the programs I recently wrote for other people, they either: - were command line scripts, meant to use for sysadmin jobs (and I wrote them for the sysadmin people around me), or - were web application, most of them written with Django I have written 3 GUI applications in the last five years, one in Tkinter, the other two in Java Swing (one being a Swing reimplementation of the Tkinter code because the users needed Java). In addition, I *contributed* to GUI applications that others had written, mainly IDLE. That, in my opinion, is where a replacement for Tkinter should be aimed: the beginning graphics programmer. But if it is built on the right foundation (which Tkinter seems not to be), it could be extended to cover far more useful cases than Tkinter can. I personally think that Tkinter is excellent for the beginning graphics programmer. I don't think so. Even vast libraries of well-written code haven't become the standard. I seem to remember a DEC assembler manual from the last century, which said A standard doesn't have to be optimal, it just has to be standard (Feel free to correct me on that one. The last century seems like a long time ago). See, that's exactly because Tkinter is the standard; I see no reason for that to change (or, rather, no chance). As a starting point, if Tkinter was replaced, an IDE similar to or more powerful than IDLE would be needed to replace IDLE. It can't be me - I don't have the clout. That's the reason why it won't happen. Everybody asking for change is not willing to lead the effort. Everybody who would be able and might be willing to lead the change fails to see the need for change. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
Am 09.06.2010 19:16, schrieb Ethan Furman: Gregory Ewing wrote: Kevin Walzer wrote: PyGUI ... certainly is *not* a lightweight GUI toolkit that could easily be incorporated into the Python core library--it instead has rather complex dependencies on both other GUI toolkits and Python wrappers of those toolkits. I don't see how the dependencies could be regarded as complex. There's more or less only one on each platform, and they're pretty standard accessories for the platform concerned. You could say there are two on Linux if you count gtk itself, but you almost certainly already have it these days if you're running any kind of desktop at all. *Alert* Potentially dumb question following: On the MS Windows platform, Gtk is not required, just win32? pywin32, to be precise. To include PyGui into Python, either PythonWin would have to be included (which would require it to be contributed in the first place), or the win32 extensions would need to be rewritten, or PyGui would need to be implemented in terms of ctypes (which then would prevent its inclusion, because there is a policy that ctypes must not be used in the standard library). I would personally prefer the win32 extensions to be rewritten for use in core Python. I think it should be possible to generate a Win32 wrapper much more automatically (e.g. using Cython, or something like it), and I think that the separation of pywin32 into modules is somewhat arbitrary - either there should be a single windows module, or the split should be by DLL (which still is arbitrary, but defined by MS). That is, of course, all off-topic. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 6/9/2010 1:16 PM, Ethan Furman wrote: [re PyGUI] *Alert* Potentially dumb question following: On the MS Windows platform, Gtk is not required, just win32? Correct. A windows distribution probably would not include the gtk (or cocoa) versions. And Greg hopes to remove the win32 dependency by calling windows dlls directly with ctypes. -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On Jun 9, 2:42 pm, Martin v. Loewis mar...@v.loewis.de wrote: I would personally prefer the win32 extensions to be rewritten for use in core Python. +1 That is, of course, all off-topic. Not entirely Martin, PyGUI is a real option to consider and PyWin32 is part of that option. Besides PyWin32 should have already been included. And PyWin32 should be standard even though Python support is not standard for Windows sadly:(. PyWin32 has been around for quite some time and has proven to be reliable. And yes it should be a single module windows or a logical split of sorts. -- http://mail.python.org/mailman/listinfo/python-list
Python Jobs
I use Python for my own entertainment and for quick jobs, but haven't been able to use it professionally up to this point. As a former Perl developer and someone that's currently required to code in Java I'm starting to wish I had this opportunity. Can anyone comment on the Python job market? If you're currently employed writing Python apps, I'd be particularly interested in knowing any of the following: - Your location - country, state or city, whatever you care to provide - Your focus - Product Development (web sites/apps), Education, RD/Science, IT/Sys Admin, etc - Your company size - Your compensation relative to the .NET/Java developers you know - generally higher/lower? In my area (Denver, CO) I predominantly see Java positions, followed closely by .NET. I'll occasionally see something pop up related to PHP or Ruby web development but hardly ever Python, so I'm just curious if I'm looking in the wrong places. Thanks for any input! -Mike -- http://mail.python.org/mailman/listinfo/python-list
Re: GUIs - A Modest Proposal
On 2010-06-09, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Tue, 08 Jun 2010 16:58:26 -0700, rantingrick wrote: We have a problem You keep saying that, but you've given no good reasons for why we should believe you, or what the nature of this problem supposedly is. The current situation has broad community support: there's a relatively lightweight GUI toolkit that ships with Python (Tkinter), even if it's not beloved by all neither is it especially hated, and an extremely healthy ecosystem of many alternative GUIs built on top of Qt, wxWindows, GTK+, and others. Where's the problem? So keep the ideas rolling in people. We need to hear from every side of this forum. I think the only way to end this pointless discussion is this: Hitler would have loved Tkinter! Yup, I'm pretty sure I heard Glenn Beck say that in a clip I saw on The Daily Show (which is the only time I ever see/hear Glenn Beck). -- Grant Edwards grant.b.edwardsYow! Here I am in 53 at B.C. and all I want is a gmail.comdill pickle!! -- http://mail.python.org/mailman/listinfo/python-list