Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Hugo Arts
On Wed, Nov 2, 2011 at 7:26 AM, wrote: > Shouldn't this be treated as a bug then? As a user I should be allowed to > uninstall the software I want to. > Or you uninstalled other things by mistake? I don't think this is a bug. Python 2.7 is required software for both Gnome and Unity. Without it n

Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Christian Witts
On 2011/11/02 08:26 AM, spa...@gmail.com wrote: Shouldn't this be treated as a bug then? As a user I should be allowed to uninstall the software I want to. Or you uninstalled other things by mistake? On Wed, Nov 2, 2011 at 6:18 AM, Joel Montes de Oca mailto:joelmonte...@gmail.com>> wrote:

Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread spawgi
Shouldn't this be treated as a bug then? As a user I should be allowed to uninstall the software I want to. Or you uninstalled other things by mistake? On Wed, Nov 2, 2011 at 6:18 AM, Joel Montes de Oca wrote: > On Tue 01 Nov 2011 08:56:41 PM EDT, Max gmail wrote: > >> Heh, yeah. It's usually a

Re: [Tutor] login window using Tk

2011-11-01 Thread Chris Hare
Thanks everyone for all of the help. I almost have this working. Everything is written in a class. I think I have that right, but that remains to be seen. :-) I can create the login window and get all of the controls on it. My function gets called to validate the information in the fields w

Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Max gmail
Heh, yeah. It's usually a bad idea to do stuff like that (I know a guy (Windows) who deleted his OS of his system). On Nov 1, 2011, at 7:40 PM, Joel Montes de Oca wrote: > I just discovered that it is a bad idea to complete uninstall Python 2.7 on > Ubuntu 11.10. If you do, expect a lot of thi

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 02/11/11 00:16, Justin Straube wrote: Have you looked into using a Frame to hold you input fields, and then using .destroy() to remove it upon successful login? This is a valid approach for some scenarios but its not the norm for login dialogs. They usually popup as fairly small standalone

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 01/11/11 21:15, Joel Montes de Oca wrote: Question, once the code is compiled to a binary, can someone inject code to cause the hidden window to show, skipping the login altogether? In general you don't compile Python to a binary, although tools exist that give a good approximation to that.

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 01/11/11 21:28, Chris Hare wrote: Good feedback Alan, thanks. I wasn't using the root window to hold the login form, although I suppose I could. I guess where I am stuck is the login to control displaying the login window, and hiding it to display the actual application window once the user

Re: [Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Joel Montes de Oca
On Tue 01 Nov 2011 08:56:41 PM EDT, Max gmail wrote: Heh, yeah. It's usually a bad idea to do stuff like that (I know a guy (Windows) who deleted his OS of his system). On Nov 1, 2011, at 7:40 PM, Joel Montes de Oca wrote: I just discovered that it is a bad idea to complete uninstall Python

Re: [Tutor] login window using Tk

2011-11-01 Thread Justin Straube
On 11/1/2011 3:28 PM, Chris Hare wrote: Good feedback Alan, thanks. I wasn't using the root window to hold the login form, although I suppose I could. I guess where I am stuck is the login to control displaying the login window, and hiding it to display the actual application window once the us

[Tutor] Python 2.7 on Ubuntu 11.10 - Do not unintall

2011-11-01 Thread Joel Montes de Oca
I just discovered that it is a bad idea to complete uninstall Python 2.7 on Ubuntu 11.10. If you do, expect a lot of things not to work, mainly your system. haha I just reinstalled Python 2.7 and I hope things are not so bad now when I reboot. -- -Joel M. ___

Re: [Tutor] login window using Tk

2011-11-01 Thread Wayne Werner
On Nov 1, 2011 4:17 PM, "Joel Montes de Oca" wrote: > > On 11/01/2011 02:18 PM, Alan Gauld wrote: >> >> On 01/11/11 18:09, Alexander Etter wrote: >> >>> Hi, hopefully a more experience hacker can provide clarity, but how >>> secure does this login need to be? I dont much about python in DRAM but >

Re: [Tutor] Problem in running script

2011-11-01 Thread Hugo Arts
On Tue, Nov 1, 2011 at 10:47 PM, Narguess Dadfar wrote: > I want to prepare a script in python that updates the attributes of the > crime incidents falling within the patrol zone. I have  a point feature > class of crime incidents and a polygon feature class of patrol zone. > > I used the getcount

Re: [Tutor] Problem in running script

2011-11-01 Thread Steven D'Aprano
Narguess Dadfar wrote: [...] But I ran to problem. Please let me know what I should change. Would you like us to guess what problem you had? My guess is... you got a SyntaxError, because you forgot to put a closing bracket on the previous line. Am I close? -- Steven

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Alan Gauld
On 01/11/11 20:24, Steve Willoughby wrote: You think emacs is bad, though? Try TECO. Thats why Mr Stallman wrote emacs! :-) I once used Teco for a month, just for a dare. The best thing about it was taking a test file and typing your name into it, and seeing if you could guess what the final

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 13:24, Steve Willoughby wrote: On 01-Nov-11 13:19, Alexander Etter wrote: I like than .png image! It does appear vi biased though! Not quite, notice the initial steep climb. :) Yes, it's tongue-in-cheek, Oops, my mistake. If the y axis is productivity and x is time using the to

Re: [Tutor] login window using Tk

2011-11-01 Thread Chris Hare
Good feedback Alan, thanks. I wasn't using the root window to hold the login form, although I suppose I could. I guess where I am stuck is the login to control displaying the login window, and hiding it to display the actual application window once the user has authenticated. Chris Hare ch

[Tutor] Problem in running script

2011-11-01 Thread Narguess Dadfar
I want to prepare a script in python that updates the attributes of the crime incidents falling within the patrol zone. I have a point feature class of crime incidents and a polygon feature class of patrol zone. I used the getcount. method to take a count of the incidents in the current layer as

Re: [Tutor] login window using Tk

2011-11-01 Thread Joel Montes de Oca
On 11/01/2011 02:18 PM, Alan Gauld wrote: On 01/11/11 18:09, Alexander Etter wrote: Hi, hopefully a more experience hacker can provide clarity, but how secure does this login need to be? I dont much about python in DRAM but your login sounds like it could be easily hacked. That depends entire

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 01/11/11 18:57, Chris Hare wrote: Here is a code snippet I have pulled out of the project. It is as bare bones as I can make it to get the point across. I think you could have dropped a lot more to be honst - like all the menu code for a start... 1. I would really like the window to be c

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Wayne Werner
On Tue, Nov 1, 2011 at 3:24 PM, Steve Willoughby wrote: > On 01-Nov-11 13:19, Alexander Etter wrote: > >> I like than .png image! It does appear vi biased though! >> > > Not quite, notice the initial steep climb. :) Yes, it's tongue-in-cheek, > but feels about right, once you master vi (or emac

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 13:19, Alexander Etter wrote: I like than .png image! It does appear vi biased though! Not quite, notice the initial steep climb. :) Yes, it's tongue-in-cheek, but feels about right, once you master vi (or emacs) you're able to be amazingly productive with complex operations in

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Alexander Etter
On Nov 1, 2011, at 16:06, Wayne Werner wrote: > On Tue, Nov 1, 2011 at 6:31 AM, Alexander Etter wrote: > There is a learning curve. > > Yes, and for a graphical comparison of learning curves: > http://jeetworks.org/files/images/emacs_learning_curves.png > > ;) > > One may find a learning c

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Wayne Werner
On Tue, Nov 1, 2011 at 6:31 AM, Alexander Etter wrote: > There is a learning curve. Yes, and for a graphical comparison of learning curves: http://jeetworks.org/files/images/emacs_learning_curves.png ;) > One may find a learning curve with everything in existence, whereas I > repudiate one di

Re: [Tutor] login window using Tk

2011-11-01 Thread Wayne Werner
On Tue, Nov 1, 2011 at 1:57 PM, Chris Hare wrote: > Here is a code snippet I have pulled out of the project. It is as bare > bones as I can make it to get the point across. > > the problems I am having: > > 1. I would really like the window to be centered in the user's screen, > but setting the

Re: [Tutor] login window using Tk

2011-11-01 Thread Chris Hare
Okay - that makes sense. The login window uses the show="*" for the password field and is authenticated against a database where the passwords are encrypted. I have this working in a text only environment, just struggling to get it right for the GUI Thanks Chris Hare ch...@labr.net http://ww

Re: [Tutor] login window using Tk

2011-11-01 Thread Chris Hare
Here is a code snippet I have pulled out of the project. It is as bare bones as I can make it to get the point across. the problems I am having: 1. I would really like the window to be centered in the user's screen, but setting the geometry doesn't place it there. (that isn't included here)

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Tim Johnson
* Alexander Etter [01 03:36]: > Rinu, I use emacs. I use Python and C++. I'm also a university > student. Last semester I learned python 2.7 using IDLE, and > continued with IDLE while I searched for alternatives over the > summer. I didn't find what I was looking for. Say, just a few > week

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 01/11/11 18:09, Alexander Etter wrote: Hi, hopefully a more experience hacker can provide clarity, but how secure does this login need to be? I dont much about python in DRAM but your login sounds like it could be easily hacked. That depends entirely on how the user is authenticated. (assum

Re: [Tutor] Paper Rock Scissors game - User's choice not returned properly

2011-11-01 Thread Alan Gauld
On 01/11/11 09:46, Peter Otten wrote: Alan Gauld wrote: Good point, although you could test the first character only... if choice[0].lower() not in ('prs'): # NB use a single string What Steven says, plus you may run into an IndexError if choice is the empty string. If you absolutely want

Re: [Tutor] improve the code

2011-11-01 Thread Alan Gauld
On 01/11/11 14:33, Dave Angel wrote: Just use the sort() method of the list object. In particular, items() returns an unordered list, so it's ready to be sorted. for residues, numbers in new_dictionary.items().sort(): I don't think this would work since sort works in place. You would need to

Re: [Tutor] login window using Tk

2011-11-01 Thread Alexander Etter
On Nov 1, 2011, at 12:47, Chris Hare wrote: > > I am working on a python Tk program which involves a login window and I am > looking for some advice. > > Currently the code I have creates a window (Toplevel) where the login > controls are and I am running that using a main loop for the window

Re: [Tutor] login window using Tk

2011-11-01 Thread Alan Gauld
On 01/11/11 16:47, Chris Hare wrote: I am working on a python Tk program which involves a login window and I am looking for some advice. Currently the code I have creates a window (Toplevel) where the login controls are and I am running that using a main loop for the window. Don't do this, it

Re: [Tutor] Help

2011-11-01 Thread Alan Gauld
On 01/11/11 04:10, Chris Kavanagh wrote: before. In other languages, ala C++, don't global variables have to be declared at the 'top' of the code?? No, that's just common usage. You can declare a variable anywhere in C/C++ provided it's before it is used. But that can lead to hard to read code

Re: [Tutor] login window using Tk

2011-11-01 Thread Joel M.
I am also intrested in this topic. Chris were you thinking of using the window.hide() method? -Joel M On Nov 1, 2011 1:21 PM, "Chris Hare" wrote: > > I am working on a python Tk program which involves a login window and I am > looking for some advice. > > Currently the code I have creates a win

Re: [Tutor] login window using Tk

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 09:47, Chris Hare wrote: Questions: 1. Is this the best way of doing this or is there a better way? 2. How do I exit the main loop when the user has authenticated? Why stop the main loop and restart it? Typically you'd setup the app, and start the main loop running for the durati

[Tutor] login window using Tk

2011-11-01 Thread Chris Hare
I am working on a python Tk program which involves a login window and I am looking for some advice. Currently the code I have creates a window (Toplevel) where the login controls are and I am running that using a main loop for the window. The root window is hidden. The objective is that when

Re: [Tutor] beginner question

2011-11-01 Thread Steven D'Aprano
Mayo Adams wrote: When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python "know" to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it automatically treat text files as sequences of line

Re: [Tutor] improve the code

2011-11-01 Thread Peter Otten
lina wrote: >> sorted(new_dictionary.items()) > > Thanks, it works, but there is still a minor question, > > can I sort based on the general numerical value? > > namely not: > : > : > 83ILE 1 > 84ALA 2 > 8SER 0 > 9GLY 0 > : > : > > rather 8 9 ...83 84, > > Thanks, You need a custom key funct

Re: [Tutor] beginner question

2011-11-01 Thread Peter Otten
Steve Willoughby wrote: > On 01-Nov-11 08:34, Mayo Adams wrote: >> When writing a simple for loop like so: >> >> for x in f >> >> where f is the name of a file object, how does Python "know" to interpret >> the variable x as a line of text, rather than,say, an individual >> character in the

Re: [Tutor] improve the code

2011-11-01 Thread Dave Angel
On 11/01/2011 11:11 AM, lina wrote: On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote: On 11/01/2011 10:11 AM, lina wrote: Hi, The following code (luckily) partial achieved what I wanted, but I still have few questions: #!/usr/bin/python3 import os.path INFILEEXT=".txt" OUTFILEEXT=".new"

Re: [Tutor] improve the code

2011-11-01 Thread Dave Angel
On 11/01/2011 11:11 AM, lina wrote: On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote: On 11/01/2011 10:11 AM, lina wrote: Hi, The following code (luckily) partial achieved what I wanted, but I still have few questions: #!/usr/bin/python3 import os.path INFILEEXT=".txt" OUTFILEEXT=".new"

Re: [Tutor] improve the code

2011-11-01 Thread lina
On Tue, Nov 1, 2011 at 11:28 PM, Peter Otten <__pete...@web.de> wrote: > lina wrote: > >> On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote: >>> On 11/01/2011 10:11 AM, lina wrote: > >>> Just use the sort() method of the list object.  In particular, items() >>> returns an unordered list, so it's r

Re: [Tutor] beginner question

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 08:34, Mayo Adams wrote: When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python "know" to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it automatically treat text files

[Tutor] beginner question

2011-11-01 Thread Mayo Adams
When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python "know" to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it automatically treat text files as sequences of lines? -- Mayo Adams

Re: [Tutor] improve the code

2011-11-01 Thread Peter Otten
lina wrote: > On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote: >> On 11/01/2011 10:11 AM, lina wrote: >> Just use the sort() method of the list object. In particular, items() >> returns an unordered list, so it's ready to be sorted. >> >> for residues, numbers in new_dictionary.items().sort()

Re: [Tutor] improve the code

2011-11-01 Thread lina
On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote: > On 11/01/2011 10:11 AM, lina wrote: >> >> Hi, >> >> The following code (luckily) partial achieved what I wanted, but I >> still have few questions: >> >> >> #!/usr/bin/python3 >> >> import os.path >> >> INFILEEXT=".txt" >> OUTFILEEXT=".new" >> D

Re: [Tutor] Tutor Digest, Vol 93, Issue 4

2011-11-01 Thread Rinu Boney
Alexander Etter , can u help me setup the emacs as python ide - like code refactoring and stuff? can i get to you by email? Thanks. > > Rinu, I use emacs. I use Python and C++. I'm also a university student. > Last semester I learned python 2.7 using IDLE, and continued with IDLE > while I searche

Re: [Tutor] improve the code

2011-11-01 Thread Dave Angel
On 11/01/2011 10:11 AM, lina wrote: Hi, The following code (luckily) partial achieved what I wanted, but I still have few questions: #!/usr/bin/python3 import os.path INFILEEXT=".txt" OUTFILEEXT=".new" DICTIONARYFILE="dictionary.pdb" orig_dictionary={} new_dictionary={} abetaABresidues={} d

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Dave Angel
On 11/01/2011 10:19 AM, Jose Amoreira wrote: HiOn Tuesday, November 01, 2011 01:55:18 PM Joel Goldstick wrote: On Tue, Nov 1, 2011 at 9:48 AM, Jefferson Ragot wrote: In a Vista command prompt if I typed this: >>> python somescript.py filename Will sys.argv[1] return a valid path o

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Dave Angel
On 11/01/2011 10:05 AM, Hugo Arts wrote: On Tue, Nov 1, 2011 at 2:48 PM, Jefferson Ragot wrote: In a Vista command prompt if I typed this: >>> python somescript.py filename Will sys.argv[1] return a valid path or just the filename? If it just returns the filename, is there a simpl

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Jose Amoreira
HiOn Tuesday, November 01, 2011 01:55:18 PM Joel Goldstick wrote: > On Tue, Nov 1, 2011 at 9:48 AM, Jefferson Ragot wrote: > > In a Vista command prompt if I typed this: > > >>> python somescript.py filename > > > > Will sys.argv[1] return a valid path or just the filename? > > If it ju

[Tutor] improve the code

2011-11-01 Thread lina
Hi, The following code (luckily) partial achieved what I wanted, but I still have few questions: #!/usr/bin/python3 import os.path INFILEEXT=".txt" OUTFILEEXT=".new" DICTIONARYFILE="dictionary.pdb" orig_dictionary={} new_dictionary={} abetaABresidues={} def processonefiledata(infilename):

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Hugo Arts
On Tue, Nov 1, 2011 at 2:48 PM, Jefferson Ragot wrote: > In a Vista command prompt if I typed this: > >     >>> python  somescript.py  filename > > Will sys.argv[1] return a valid path or just the filename? > If it just returns the filename, is there a simple way to get the path? > sys.argv c

Re: [Tutor] A question about sys.argv

2011-11-01 Thread Joel Goldstick
On Tue, Nov 1, 2011 at 9:48 AM, Jefferson Ragot wrote: > In a Vista command prompt if I typed this: > > >>> python somescript.py filename > > Will sys.argv[1] return a valid path or just the filename? > If it just returns the filename, is there a simple way to get the path? > > -- > Jef

[Tutor] A question about sys.argv

2011-11-01 Thread Jefferson Ragot
In a Vista command prompt if I typed this: >>> python somescript.py filename Will sys.argv[1] return a valid path or just the filename? If it just returns the filename, is there a simple way to get the path? -- Jefferson B. Ragot ___ Tutor m

Re: [Tutor] Help

2011-11-01 Thread Dave Angel
(Pleas put your reply after the part you're quoting. What you did is called top-posting, and makes reading the messages very confusing) On 11/01/2011 12:10 AM, Chris Kavanagh wrote: I'm going to thank Steven once again, and answer my own question in the 2nd paragraph directly below (Steven hasn

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Alexander Etter
On Oct 31, 2011, at 15:31, Tim Johnson wrote: > * Rinu Boney [111031 07:03]: >> I Use Windows.I Already Know C/C++ which makes python syntax seem very easy. >> Maybe Setting Up Emacs With Python Will Make Me Productive. >> I Have Eclipse With PyDev. >> Why Is There Not A Pythonic Emacs? > Rinu,

Re: [Tutor] Paper Rock Scissors game - User's choice not returned properly

2011-11-01 Thread Peter Otten
Alan Gauld wrote: > On 31/10/11 20:22, Peter Otten wrote: >> Alan Gauld wrote: >> >>> if choice.lower() not in ('prs'): # NB use a single string >> >> That's not a good idea. If a user accidentally enters PR (for example) >> your version will mistake that for a valid choice. > > Good point, altho