Re: [Tutor] Defining "bit" type

2009-01-25 Thread Vicent
On Sat, Jan 24, 2009 at 20:43, bob gailer wrote: > Vicent wrote: > > > It would be great if "b.value = 0" could be just written as "b = 0" > without changing type as a result. > > > Assignment in effect does a del b, then creates a new b based on the > expression. There is no way in Python r

Re: [Tutor] Defining "bit" type

2009-01-25 Thread Kent Johnson
On Sun, Jan 25, 2009 at 5:13 AM, Vicent wrote: > I think I hadn't get that "0" is always integer, but now I get it. If I want > to make it boolean (bit-like), it should be referred as "bool(0)". [It is > like that, isn't it] Yes, though bool(0) is actually creating a new bool object with t

[Tutor] Creating a PDF from http://effbot.org/imagingbook/

2009-01-25 Thread Wayne Watson
Title: Signature.html I have acrobat pro 8, but have only used it occasionally. I tried creating a pdf from . It worked, but I had hoped it would draw in all the links in the "TOC".  Not so.  Maybe someone knows how to do this, or perhaps there's already a pdf with everything in it? --

[Tutor] string problem

2009-01-25 Thread Manoj kumar
  i was trying to write a script for a port scanner. i was able to get a working scanner which can scan a given host. now i want to upgrade it to scan for a given range of ip address. for example: starting ip:166.43.234.43 last ip:234.23.45.123 no problem i am facing is that i am really NOT ab

Re: [Tutor] string problem

2009-01-25 Thread Eugene Perederey
What's a problem to split the string like >>>'166.43.234.43'.split('.') Maybe I misunderstand you problem... 2009/1/25 Manoj kumar : > > i was trying to write a script for a port scanner. i was able to get a > working scanner which can scan a given host. > > now i want to upgrade it to scan for a

[Tutor] Find a Word in *.py (Win XP)

2009-01-25 Thread Wayne Watson
Title: Signature.html If I open a folder in Win XP with a number of py files, and when I search for *.py for the word angle, I get zippo. However, the word exists in one of the py files. Probably the py files are scrambled in some way. How nevertheless do I find the file. BTW, I know where it i

Re: [Tutor] Find a Word in *.py (Win XP)

2009-01-25 Thread Kent Johnson
On Sun, Jan 25, 2009 at 10:31 AM, Wayne Watson wrote: > If I open a folder in Win XP with a number of py files, and when I search > for *.py for the word angle, I get zippo. However, the word exists in one of > the py files. Probably the py files are scrambled in some way. How > nevertheless do I

[Tutor] No module named 'module name'

2009-01-25 Thread Robert Berman
In the following code: import sys from PyQt4 import QtCore, QtGui from testwin import Ui_TestWindow class StartQT4(QtGui.QMainWindow): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_TestWindow() self.ui.setupUi(self)

Re: [Tutor] No module named 'module name'

2009-01-25 Thread Alan Gauld
"Robert Berman" wrote from testwin import Ui_TestWindow I receive the following error message: Import error: No module named testwin. If I use ipython and do the from statement, it works just fine. I think it may have something to do with a path value I think you are right! Try putting

Re: [Tutor] No module named 'module name'

2009-01-25 Thread Robert Berman
Alan, After you gave me the blatant hint to look at the system path; the problem became obvious. Wing assigns the path of the project file to one of the paths revealed by sys.path. I, of course, had put the project file in the folder above my working folder. Another learning experience. Th

Re: [Tutor] No module named 'module name' -- sub-folders?

2009-01-25 Thread spir
Le Sun, 25 Jan 2009 18:04:00 -, "Alan Gauld" a écrit : > Nope, PYTHONPATH applies to any OS. > You need to use it if you have any modules in folders other than > the default locations used by Python. I think the preferred place > to set PYTHONPATH is in your .login script but if I'm wrong I'

Re: [Tutor] No module named 'module name' -- sub-folders?

2009-01-25 Thread Kent Johnson
On Sun, Jan 25, 2009 at 4:21 PM, spir wrote: > I take the opportunity to ask a question about module lookup. I was *sure* > that, when searching for a module, python automatically explores sub-folders > (both of the current folder and of the pathes listed in PYTHONPATH). But this > does not wo

[Tutor] To Arc (PIL) or Not to Arc (Tkinter)

2009-01-25 Thread Wayne Watson
Title: Signature.html I'm working on making changes to a GUI program that I did not write. It uses PIL and Tkinter. I'm pretty much making good progress, but my question is what each class really does with respect to each other? Here's my view. When I noticed that both have an arc method that

Re: [Tutor] To Arc (PIL) or Not to Arc (Tkinter)

2009-01-25 Thread Alan Gauld
"Wayne Watson" wrote When I noticed that both have an arc method that gave me pause. Apparently, PIL provides IP (image processing: ...while Tkinter provides widgets. In PIL, arc allows one to draw on images but doesn't allow one to display them. The display and presentation is the function

[Tutor] Python Program: Newton's Method

2009-01-25 Thread Donna Ibarra
Hello, I need to write a program that implements Newton's method ((guess + x/guess) / (2)). The program should prompt the user for the value to find the squareroot of (x) and the number of times to improve the guess. Starting with a guess value of x/2, your program should loop the specified number

Re: [Tutor] Python Program: Newton's Method

2009-01-25 Thread John Fouhy
2009/1/26 Donna Ibarra : > I need to write a program that implements Newton's method [...] What problems are you having? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Program: Newton's Method

2009-01-25 Thread Kent Johnson
On Sun, Jan 25, 2009 at 6:11 PM, Donna Ibarra wrote: > Hello, > > I need to write a program that implements Newton's method ((guess + x/guess) > / (2)). The program should prompt the user for the value to find the > squareroot of (x) and the number of times to improve the guess. Starting > with a

[Tutor] import confusion

2009-01-25 Thread Eric Abrahamsen
Hi there, I'm trying to understand how module imports work, and am seeing some behavior I don't understand: >>> import django >>> from django import forms >>> from forms import DecimalField Traceback (most recent call last): File "", line 1, in ImportError: No module named forms >>> import

[Tutor] How Do I Put an Image on a Canvas and Display it?

2009-01-25 Thread Wayne Watson
Title: Signature.html I've started with this, but it's not hacking it. Aside from not knowing how to attach img to the canvas, it has a few problems. First it gives:     AttributeError: class Image has no attribute 'open' wagon.tif does exist in the same folder as the program. Then draw.line(

Re: [Tutor] import confusion

2009-01-25 Thread Marc Tompkins
On Sun, Jan 25, 2009 at 8:23 PM, Eric Abrahamsen wrote: > Hi there, > > I'm trying to understand how module imports work, and am seeing some > behavior I don't understand: > > >>> import django > >>> from django import forms > >>> from forms import DecimalField > Traceback (most recent call last):

Re: [Tutor] import confusion

2009-01-25 Thread Marc Tompkins
On Sun, Jan 25, 2009 at 9:45 PM, Eric Abrahamsen wrote: > > Thanks for the break-down! I've got a fairly good handle on how to make all > this work correctly, I guess what I'm after is an understand of why the > above produces an error. What's going on in the system's module accounting > that makes

[Tutor] clipboard questions

2009-01-25 Thread Che M
I'm curious about how to interact with the contents of the clipboard effectively and have a couple of questions... 1) Is there one cross-platform way to read the clipboard, or does one have to have a different way to do it for Win, Mac, and Linux? (I have seen some ways with the win32clipboard