the code.
Hope I have explained myself so people can understand what I mean.
Looking forward to the light of understanding.
Regards
John Aherne
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
the 'a' appear in 'atest'. It is like the code works first,
sets the text to 'test' and then the key press works and inserts the
'a'. Do I need to disconnect the key press signal?
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http
Sandro,
That's exactly what I need.
Thanks,
John.
def callback3(self,data,widget):
input = data.get_text()
print input
data.set_text(test)
If you don't return True, default callback will be called that insert
the 'a'.
I have something like
and unchecking should hide
it.
[...]
Hi Amresh,
I suggest you try asking on the wxPython list,
[EMAIL PROTECTED] (you will probably have to
subscribe first).
The people on that list are both very knowledgable and very helpful :-)
--
John.
___
Tutor
structure that expresses what beats what,
and then reduce your code to:
if human.choice == computer.choice:
print 'Draw!'
elif # human beats computer
print 'Human wins!'
else:
print 'Computer wins!'
HTH :-)
--
John
think what he wants is:
if 'teststring' in [s.type for s in all_types]
...
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 09/08/06, Alan Gauld [EMAIL PROTECTED] wrote:
But type is still not accessible as an attribute.
It looked to me like he wanted a list of dictionaries
in which case it wouyld be:
if teststring in [s['type'] for s in all_types]
Err, that is what I meant :-)
--
John
constraint is met.
Hi Kermit,
Is there anything particular that you're stuck on?
I think I understand your function, although I'm not sure what role z
plays. Are you looking for help on how to translate the description
you've given into logic suitable for programming?
--
John
On 09/08/06, Kermit Rose [EMAIL PROTECTED] wrote:
Hello John.
Thanks for replying.
In my previous version, I used z as the critical value,.
Since I created zlim, a function of z, to be passed in as a parameter, I no
longer need z
in the parameter list.
In another part of the program
that all the information about your GUI is brought together
in one place where it's easy to see, and all the mechanical work is
pushed off to one side :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
that always pick what the human picked in the previous round
tend to do better than random (unless the human notices, at which
point they start doing very badly :-) ).
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
], args[2])# could replace
this with: return _range(*args)
def _range(start, stop, step):
# etc
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
conditions, so it doesn't have its own condition.
What I often like to do is to use a comment to indicate what is true
in the 'else' branch. eg:
else: # node.cargo = self.head.cargo
self.last.next = node
self.last = node
HTH!
--
John
: key in dict is equivalent to dict.has_key(key))
(are you new to programming in general, or just python in particular?)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
) is a datetime.timedelta,
and (date1-date2).days is the number of days in the timedelta.
Reading the documentation helps!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 25/07/06, Nathan Pinno [EMAIL PROTECTED] wrote:
What's the invalid syntax?
I don't know, what did python tell you when you tried to run the code?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--+-- None
||||
| cargo-\|| cargo-\|
\---+/\---+/
| |
\|/ \|/
cargomore cargo
Hope this helps; if not, ask more questions :-)
--
John
= self.wTree.get_widget(ent)
Is it possible to do what I want it to do? Am I on the right lines? Any help or advice would be greatly
appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
with: tkFont.Font instances support a .measure method. So, if
f is a tkFont.Font, then f.measure('hello world!') will return how
many pixels wide that string would be on the screen. You could maybe
compare this with the width of the widget itself?
--
John.
___
Tutor
!
I have downloaded the ValidatedEntry
extension and had a quick look at it. It looks like it will sort out my
validation problems.
A good team effort!
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
for a way to keep the numbers right justified.
Any suggestions or comments as always are greatly
appreciated.
Regards,
John.
def
callback36(self,data,text37,text38,text39,text40,text41,text42,label):
a =
text37.get_text()
b =
text38.get_text()
c =
text39.get_text()
d
;
it's more helpful than you might expect :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
.
# untested
def cmptime(s1, s2):
Compare two times as strings in %H:%M:%S format.
return cmp(time.strptime(s1, '%H:%M:%S'), time.strptime(s2, '%H:%M:%S'))
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo
abcb, which is the longest match, and thus
probably the one it found.
If you look at the match object returned, you should se that the match
starts at position 0 and is four characters long.
Now, if you asked for a[bcd]*b$, that would be a different matter!
HTH :-)
--
John
can read the documentation --- a combination of both approaches
usually works quite well :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 14/07/06, anil maran [EMAIL PROTECTED] wrote:
i want to know how to generate
[EMAIL PROTECTED] = [EMAIL PROTECTED]
and then how do i do the translation
[EMAIL PROTECTED] = [EMAIL PROTECTED]
Hi Anil,
Do you have any programming experience in other languages?
--
John
everything out :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
should be fun stuff with data
structures.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
(self):
return self.balance
V/R
CW2 John Shappell
HHB 2-44 ADA BN
Work 270-798-6823
FAX 775-618-2455
[EMAIL PROTECTED]
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Tue, 11 Jul 2006 06:41:23 -0500
Luke Paireepinart [EMAIL PROTECTED] wrote:
Hi.
Shappell, John J CW2 wrote:
Here is the assignment
[snip assignment]
Please don't ask about homework in the future. Did your professor tell
you to submit queries to this list? If so, could you ask him
implement it.
Hi Chris,
You are using iteration. That's what loops are :-)
Perhaps you meant to say recursion, which is where a function calls
itself. You could solve this recursively, but I think Gregor's
comment is closer to what they want you to do.
--
John
first ---
keepSet = set(lstKeepers)
for key in myDict.keys():
if key not in keepSet:
del myDict[key]
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
(source):
for f in files:
os.rename(os.path.join(root, f), os.path.join(dest, f))
(although I would do a test run first, if I were you, since I often
get os.walk wrong :-) )
--
John.
___
Tutor maillist - Tutor@python.org
http
On 10/07/06, Abhinav Gaurav [EMAIL PROTECTED] wrote:
Hi,
Thanks for your help! I am wondering if it works fine then why it failing on
my comp. And what is the remedy for it?
What version of python are you running?
--
John.
___
Tutor maillist
in your Frame object?
(do you know the difference between local variables and object attributes?)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 29/06/06, Kent Johnson [EMAIL PROTECTED] wrote:
See shutil.copyfile()
Why isn't this function in the os module with the other file commands?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
the output you want.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Also, does anyone know of a PDA that would run python?
Some of the new Nokias run python: http://www.forum.nokia.com/python
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
and then calls the function again.
Is there a better way to do it? Would appreciate
feedback on the code below.
import shutil
import
os
def
zaps(self):
try:
shutil.rmtree('f:/m2m')
except OSError,
inst:
print
OSError
os.chmod(inst.filename,
0666)
self.zaps()
Regards,
John
:'
for attr in dir(e):
print '%s: %s' % (attr, getattr(e, attr))
button.connect(clicked, show)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
onQuit somewhere else in that method, this code
should be a dropin replacement for the line you quote.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
approximately five seconds _after_ I send off my question..
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Check out Python MegaWidgets (pmw.sourceforge.net).
On 07/06/06, Keo Sophon [EMAIL PROTECTED] wrote:
Hi,
Is there any Combo Box in Tkinter? I looked for it but only found list box.
Might it be list box having any option to make itself as a combo box?
Thanks,
Phon
--- 'import Tkinter' or 'from Tkinter import *' won't bring
it in.
New Mexico Tech has a good reference too:
http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html It's a bit
old, but a lot of it is still accurate, and it goes into more detail
than the pythonware one.
--
John
at Python code and have a very good idea of what is happening and
why unless it's written in OOP style in which case I have no idea.
John
_
Read, write and reply to Hotmail on your mobile. Find out more.
http
) is an integer, and python displays integers
in base 10 by default --- hence, you see 33.
By the way, you can enter integers in base 8 or base 16, if you want:
0x21, 041
(33, 33)
0x21 is 041 is 33
True
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
-\n --- \n - \n'
print s
Hello
World!
-
---
-
Or, you could try typing print calendar.calendar(2006) into your console :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo
improving? Or does
it not count as I have solved my own problem?
Regards,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
translation would be something like:
fibs = [0, 1] + [ a+b for (a, b) in zip(fibs, fibs[1:])]
But you can't quite do that in python :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
75025 2.14721368219
26 121393 4.08266218193
27 196418 20.1769099145
Hmm, do you know an easy way to check how much memory python is using?
My HDD was swapping like crazy by the end of that..
--
John.
___
Tutor maillist - Tutor@python.org
http
, line
1
, in callback53
result = model.get_value(iter,0)
TypeError: iter must be a GtkTreeIter
What do I need to assign to iter
to make this code work?
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
I have a file with 10,000 + lines and it has a coma delimited string on each
line.
The file should look like:
DFRE,ship name,1234567
FGDE,ship 2,
,sdfsf
The ,sdfsf line is bad data
Some of the lines are messed up...I want to find all lines that do not end
in a comma or seven digits and do
Kent,
Thanks for the nock on the head, that has bitten me before. Taking out the
spaces worked great.
Thanks again,
John Ertl
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Monday, May 08, 2006 10:53 AM
Cc: tutor
, maybe? I got that from the cheese shop (under the links menu
at python.org): http://cheeseshop.python.org/pypi/PyMedia/1.2.3.0
See also http://cheeseshop.python.org/pypi?:action=browseasdf=338.
--
John.
___
Tutor maillist - Tutor@python.org
http
.
Any help greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Liam,
Thanks for the prompt reply. That is working for me.
Regards,
John,
-Original
Message-
From: Liam Clarke
[mailto:[EMAIL PROTECTED]
Sent: 07 May 2006 13:06
To: [EMAIL PROTECTED]
Cc: tutor@python.org
Subject: Re: [Tutor] Button
Signals
Hi John,
I'll answer
?
Any help greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
])
store.append ([Tue])
store.append ([Wed])
store.append ([Thu])
store.append ([Fri])
store.append ([Sat])
store.append ([Sun])
combo2.set_model(store)
combo2.set_text_column(0)
combo2.set_active(0)
It works but I am not sure why.
Regards,
A Very Happy John
of
reading the nested list comprehension syntax that makes sense, I would
appreciate it if you would share it.
Thanks,
-John
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
?
Any help greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
birthday. So I was wondering (bearing in mimd that I'm only 2 or
3 steps above total beginner), what is the one book on python that I
shouldn't be without?
John
_
realestate.com.au: the biggest address in property
http
be a bit more careful about giving examples that are quick
fixes as opposed to best practice.
John
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Hugo González Monteverde
Sent: Wednesday, May 03, 2006 12:05 PM
To: tutor@python.org
Subject
with compiling but I am not sure. Any
ideas how to speed this up?
I am running python 2.4 on a RHE3.0 cluster.
Thanks,
John Ertl
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Kent,
The files are very small (a few hundred lines). Maybe it is a network
issue? But then why is it always slow the first time in the morning? I
don't know network stuff but that seams a bit strange.
Thanks,
John Ertl
-Original Message-
From: Kent Johnson [mailto:[EMAIL
Kent,
I will check with the systems guys...and the Perl guys down the hall to see
if they have the same problem.
Thanks for the help.
John Ertl
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Tuesday, May 02, 2006 12:27 PM
myUse.sendEmail(%s memory/inode limit reached on gpfs %
myUse.userName)
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 1:32 PM
To: Ertl, John
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
I have been using python
simplify that line to:
if isinstance(v, (int, float)):
block
(also, you might want to check if it's a long as well --- ie:
isinstance(v, (int, float, long)))
Another possibility, maybe:
try:
int(v)
block
except ValueError, TypeError:
pass
--
John
?
John
_
New year, new job there's more than 100,00 jobs at SEEK
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau_t=752315885_r=Jan05_tagline_m=EXT
___
Tutor
for that round was %d % (totalScore)
playAgain = raw_input(\nPlay again? (y/n) )
print
if playAgain != y:
break
John
_
realestate.com.au: the biggest address in property
http://ninemsn.realestate.com.au
On 30/04/06, John Connors [EMAIL PROTECTED] wrote:
The wife and I play a silly dice game and I thought it would be a good
challange for me to write it as a program. No specific question, just
wondering if my technique is ok and is there anything that could be done
better. The 2 hardest things
G'day John,
If I were you, I would look at separating more of my program out into
functions. Good use of functions will make your program more
readable, easier to debug, and easier to change, should the rules of
your dice game change :-)
Yes, the rules change on a regular basis, usually
the namespaces part of the tutorial.
John
_
Bounce Back from sickness and injury today.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fclk%2Eatdmt%2Ecom%2FMOS%2Fgo%2Fnnmsngem001007mos%2Fdirect%2F01%2F_t=753470755_r
to reverse the end
for you as well. So, we could rewrite the last function as:
def mirror(seq):
end = seq[-2::-1]
return seq + end
Which means there is a one-line version as well:
def mirror(seq):
return seq + seq[-2::-1]
HTH!
--
John
doesn't work and if the syntax is wrong why
doesn't it return an error.
John
PS I apologise if this is a duplicate, hotmail did some kind of spam check
when I tried to send it, I've waited 30 mins and I don't think it went the
1st time so I'll post it again
G'day Payal,
I had trouble understanding the namespaces section of the tutorial too but
it all clicked the other day when Alan explained the difference between
import first and from first import *
John
Hi,
In Alan's tutorial I haven't got the example of print42() even after
reading
:
test_tcl
...
John Hsu
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
G'day John,
There is a problem with a recent python update and fedora, if you go to
http://forums.fedoraforum.org/ and do a search in the forum for tkinter
and/or idle you will find the fix.
I'm running Fedora Core 5 and found I had to install tkinter, I had to do a
yum install tkinter
G'day,
I'm having trouble understanding the difference between,
import sys
and
from sys import *
It seems to me they both do the same thing.
John
_
New year, new job there's more than 100,00 jobs at SEEK
http
'
s1, s2 = s[::-2], s[-2::-2]
s1
'13579'
s2
'2468'
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
])))
c.execute('UPDATE cost_grid SET
ie_rrp_20 = ? where cost_grid_id = ? and finish_dro = ?', ( float(row[62]), row[0], float(row[2])))
db.commit()
c.close()
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
\n']
The full error is
Traceback (most recent call
last):
File
C:\Python24\Lib\site-packages\databasemanager.py, line 30, in ?
c.execute(stat,
listy[-1])
TypeError: parameters must be a
list of tuples
Thanks,
John.
___
Tutor maillist
(most
recent call last):
File
C:\Python24\Lib\site-packages\databasemanager.py, line 31, in ?
c.execute(stat,
sql_list)
TypeError: parameters
must be a list of tuples
Unfortunately sql_list gives the
same error.
Thanks,
John.
___
Tutor
requires floats for the numbers instead of
strings. I assume that the numbers
in listy[0]
are now strings. Am I now going to
have to throw listy[0] through a function to make the numbers into floats or is
there another way to do this?
Am I on the right track?
Thanks,
John
, '[Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified', 6044)
What am I doing wrong and what do I need to do? Any help would be greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor
, '[Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified', 6044)
What am I doing wrong and what do I need to do? Any help would be greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor
Liam,
Thanks for the quick response. I have changed the code so that dsn is now
DSN. However I get the same error.
Any other thoughts?
Regards,
John.
-Original Message-
From: Liam Clarke [mailto:[EMAIL PROTECTED]
Sent: 15 April 2006 15:02
To: [EMAIL PROTECTED]
Cc: tutor@python.org
)
It gives me the same error that I am experiencing when I run
my code. Does this mean that I have not
installed something that I need or have not installed something properly.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http
. Is this what I need
to log onto with python first before I access the database file?
Regards,
John.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Kent Johnson
Sent: 15 April 2006 15:40
Cc: tutor@python.org
Subject: Re: [Tutor] odbc
John CORRY wrote:
I
Hi,
Good advice. I configured the ODBC data sources as advised and I am now
able to query my database files.
Thanks,
John.
-Original Message-
From: Lloyd Kvam [mailto:[EMAIL PROTECTED]
Sent: 15 April 2006 16:04
To: [EMAIL PROTECTED]
Cc: Kent Johnson; Tutor Python
Subject: Re: [Tutor
Patty wrote:
I have a data structure in a python file that looks something like this:
my_map= { host1: {target1, target2, target3 },
host2: {target4, target5, target6 },
}
cursor.execute(SELECT %s FROM targets
WHERE target_name = %s % (ahost, target))
Can
I'am very new to pygame, and python and any help would help me so much thx.
I have no idea whats wrong the chimp.py ex. works perfect, but when I get to http://rene.f0o.com/mywiki/LECTURETHREE, I get so stuck becuz the callwindow =
pygame.display.set_mode((468, 60)) makes a window like it should
knowledge with databses. I have created and modified some
gadfly databases but on a very simple level.
Any help would be greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
]
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
what your goals are before you go diving
towards a solution :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
=\n']
002, borfiled, dial= 02890 618521, dial=
002, borfiled, dial= 02890 618521, dial=
['003, newcomp, dial=02890419689, dial=']
003, newcomp, dial=02890419689, dial= 003, newcomp, dial=02890419689, dial=
Any help would be greatly appreciated.
Regards,
John
!'
sys.exit()
ziparchive = zipfile.ZipFile(inputfilename, 'r')
# ...
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 30/03/06, Jerome Jabson [EMAIL PROTECTED] wrote:
import re
arg1 = '10
p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)')
Have a look at string substitutions :-) ---
http://docs.python.org/lib/typesseq-strings.html
p = re.compile(r'%s\.(\d+\.\d+\.\d+)' % arg1)
--
John
This actually sounds like very good idea. I have not heard of it before, but I think it would be a very good way to learn. Let me know if you find anything.JohnOn 3/28/06,
Noufal Ibrahim [EMAIL PROTECTED] wrote:
Greetings all, Are there any programs for python that offer an interactive
this output?
Hint: the len() function will tell you how long a string is.
eg: if vehicle == 'car' then len(vehicle) == 3.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
this:
D['d']['c'] = 1
TypeError: object does not support item assignment.
I can't reproduce this...
D = {}
D['d'] = {'a':7, 'b':0}
D['d']['c'] = 1
D
{'d': {'a': 7, 'c': 1, 'b': 0}}
Are you sure you haven't mistakenly assigned something other than a
dict to D or D['d'] ?
--
John
601 - 700 of 958 matches
Mail list logo