Quoting Jonas Melian <[EMAIL PROTECTED]>:
> Thank you very much!.
>
> I didn't want to make it using the old-style programming because it's
> more large and I'm supposed that slower that using a list comprehension
> solution.
Well, we can investigate, to find out the truth :-)
Hopefully you ca
Quoting Jonas Melian <[EMAIL PROTECTED]>:
> best = [ [1024, 768], [800, 600], [640, 480] ] (it's larger)
>
> modes = [
> (24, [1280, 1024]),
> (24, [1024, 768]),
> (24, [640, 480]),
> (16, [1600, 1200]),
> (16, [1280, 1024]),
> (15, [320, 200]),
> ]
>
> I want to create a list with ALL elements
Quoting Nathan Pinno <[EMAIL PROTECTED]>:
> Is it possible to create a def that not only deals cards, but also
> assigns a value to each rank, except that the Jacks, Queens, and Kings
> all are the same value as the 10s?
> If this is possible, how should I go about doing this?
Nearly everything i
Quoting Alan G <[EMAIL PROTECTED]>:
> > Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0,
> > 0, 0 ] )
> > After Quant is created, I want to sort it by MTD. If I use a simple
> > Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> > what I want.
> you need to wr
Quoting Srinivas Iyyer <[EMAIL PROTECTED]>:
> 2. I know how to read a tab delim txt file as list but
> not into the tupeles. Apologies for my inexperience.
How are you currently reading the file? --- can you show us some code?
You can create tuples directly. For example:
>>> x = 3
>>> y = 7
>
Quoting Srinivas Iyyer <[EMAIL PROTECTED]>:
> My question is how can I code to distinguish all high
> scoring group and all low scoring group.
One thing you need to decide is what it means to be high scoring. Is an element
high scoring if its score is above some threshhold, or it a percentage?
Quoting Nathan Pinno <[EMAIL PROTECTED]>:
> I tried fixing it. Here is the new code:
There are two likely places where you could have a problem: In your save
function, or in your load function. Have you tried looking at the file where it
saved the information? If the file doesn't contain the da
Quoting Nathan Pinno <[EMAIL PROTECTED]>:
> Here is the error:
>
> Traceback (most recent call last):
> File "D:\Python24\password.py", line 91, in -toplevel-
> save_file(sitelist)
> File "D:\Python24\password.py", line 22, in save_file
> for site,ID,passcard in sitelist.items():
> ValueError
Quoting Dan Deternova <[EMAIL PROTECTED]>:
> ok. i know python and want to turn all my programs i made when i was
> learning python into Tkinter programs. i dont know how to make if
> satments and display the output like this in python:
> if cmd == quit:
> print "press exit to quit"
> i have n
Quoting Tom Cloyd <[EMAIL PROTECTED]>:
Compare the filename here:
> webbrowser.open_new("C:\__Library\folders\05238 Design for Confusion\05238
> Design for Confusion -05krugman.html")
With here:
> WindowsError: [Errno 2] The system cannot find the file specified:
> 'C:\\__Library\x0colders*38
Quoting Dick Moores <[EMAIL PROTECTED]>:
> Why are list comprehensions called that?
Because that's what they're called in Haskell, I guess..
It's historical, based on the term "set comprehension" from mathematics, also
known as "set builder notation": http://en.wikipedia.org/wiki/Set_comprehensi
Quoting Jorge Louis De Castro <[EMAIL PROTECTED]>:
> Hi all,
> I wrote a few small applications, couple hundred of lines each and one
> of them playing around with tkinter. Now py2exe leaves 10 or so files of
> all sorts and one executable to "distribute", and cx freeze isn't much
> better. Furth
Quoting Alan G <[EMAIL PROTECTED]>:
> I found my message to Nathan, looks like I pressed the wrong
> reply button in the Outlook Express newsreader. I thought I'd
> forward it to the list since:
> a) we don't often discuss the turtle module and
Wow, I never knew this existed...
> > (The righward
On Wed, 27 Jul 2005, luke wrote:
> VB is not a good language to learn because it is the complete opposite
> of every other programming language.
If you think that's true, google some time for "esoteric programming languages"
:-)
Some examples:
http://www.muppetlabs.com/~breadbox/bf/ --- an 8
Quoting David Holland <[EMAIL PROTECTED]>:
> Dear Tutors,
>
> I know how to open files in python, however what I want to do is select
> some information from an excel spreadsheet and save it as a .dat file.
> The bit, I am stuck on is :-
> How can I select all rows with a row number greater th
> > > >Is there a command like more(1) or less(1) in python to display
> > > >the output of a command (e.g. dir()) one page at a time?
You could always write your own ...
eg:
def page(it, numLines=20):
if isinstance(it, dict):
it = it.iteritems()
for i, x in enumerate(it):
prin
via Dr Dobbs, check out:
http://www.microsoft.com/technet/scriptcenter/scripts/python/pyindex.mspx
It's a bunch of short python scripts provided by Microsoft, showing how to use
win32com to do all sorts of stuff.
Could be a very useful source of examples if you do development on Windows!
--
Joh
Quoting Bernard Lebel <[EMAIL PROTECTED]>:
> I'm trying to bind an event to the changes made to an OptionMenu. Ie
> the user chooses a different item, the rest of the Tk window gets
> updated. To repopulate the window, a function would be called by the
> binding.
>
> Any suggestion?
The easiest
Quoting Jorge Louis De Castro <[EMAIL PROTECTED]>:
> I was wondering, and maybe this is because I come from a different
> programming language background, but is a word count using len(list)
> after a string.split, efficient if there are many words? Or should I
> write my own word count for large(
Quoting Bernard Lebel <[EMAIL PROTECTED]>:
> I have this problem. I build a list of elements, and I never know in
> advance how many or what will be the elements.
>
> I then wish to populate an OptionMenu with this list of elements.
Do you know the list of elements before you create the option m
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> Please let's talk about this more! *grin*
> I'm not sure if I'm following you, what I see here is a function inside
> other function and the first function returns its inside function, but
> how does it work?
In Python, as in other modern languages,
Quoting Bernard Lebel <[EMAIL PROTECTED]>:
> Can you specify a justification for a label widget? I'm reading there
> is a justify option available on this page:
> http://www.pythonware.com/library/tkinter/introduction/x611-text-formatting.htm
> Although I don't know if this option works for label.
Quoting Sam Klinger <[EMAIL PROTECTED]>:
> Hi my name is Sam Klinger and I made a smal program to help find out
> the cost of listing and selling an item on ebay. However I see nothing
> wrong with the code but I get these error messages:
Hi Sam,
The problem is here:
> def listing_price():
> p
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> I'm using the Multilistbox class and I noticed that it only handles the
> mouse scroll and the scrollbar to go down or up.I succesfully
> implemented the sort function that came with the class
> I also added code to handle the up and down arrow keys a
Quoting Bill Campbell <[EMAIL PROTECTED]>:
> I'm going to be doing some work where I'll be doing existence
> testings on keys on about a million records where it may require
> multiple passes so I'm a bit concerned about the timing of these
> tests.
If you're just doing existence testing, is it a
Quoting Max Russell <[EMAIL PROTECTED]>:
> I have a list in this format:
>
> puckman puckmana puckmanf puckmanh pacman
> pacmanf puckmod pacmod
> newpuc2 newpuc2b newpuckx pacheart hangly
Hi,
You can use .split() to turn a string like that into a list of the individual
elements.
(when called
Quoting Michael Lange <[EMAIL PROTECTED]>:
> I don't think it will work this way, because you don't catch the event
> bind() passes to the callback
> (you also use a variable "e" in makeCallback() that isn't defined
> anywhere).
That's what the variable 'e' is doing!
Here is some code I just wro
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> Is there any way that I can link a button to go to certain web page?
> and how can I do that?
If you want to open a web page in the user's default browser, check out the
webbrowser module in the standard library.
If you want to go to a website and s
Quoting Dave S <[EMAIL PROTECTED]>:
> Thank you, that has clarified a few points but raised a query.
> tk.geometry('400x400') does not appear to have any effect on its size
> when the window is drawn, the window is always the same size and short
> of maximizing it to full screen it is not adjustab
Quoting Ron Weidner <[EMAIL PROTECTED]>:
> Or, more to the point... I need to dynamicaly create
> clickable labels, each using the same callback. When
> clicked, I need to know which one was clicked. I was
> hoping to use the "text" of the label as the argument
> to another function.
You've got o
Quoting Ron Weidner <[EMAIL PROTECTED]>:
> > > tk = Tk()
> > > tk.config(background='pink')
> > > tk.geometry('400x400')
> > >
>
> tk.geometry( "320x150+200+200")
Hmm. In my experience, a call like tk.geometry('400x400') will resize tk
without moving it...
--
John.
___
Quoting Servando Garcia <[EMAIL PROTECTED]>:
> Hello List
> I am working on creating a Domain Specific Language that will solve
> partial differential equations. The user will enter a equation in
> pseudo code format. I will need to parse the equation. Here is the BNF
> for the equation
.
Quoting Mark Kels <[EMAIL PROTECTED]>:
> I do want it to type in any entry (websites, notepad and other
> programs), and thats what makes it harder. I dont think that shouldnt
> be too hard as well, but I have no idea how to do it.
You would need some way of getting a handle for the widget you wa
Quoting Ron Weidner <[EMAIL PROTECTED]>:
> What's wrong with this code? Or more to the point,
> how do you set the focus to an Entry widget?
Look at what the error message is saying:
> self.cmd.focus()
> AttributeError: 'NoneType' object has no attribute
> 'focus'
Translation: self.cmd is a '
Quoting Dave S <[EMAIL PROTECTED]>:
> >But I do not understand where Frame fits in to this ... ie
> >
> >from Tkinter import *
> >class Hello(Frame):
> >
> > def __init__(self, parent=None):
> > Frame.__init__(self, parent)
> > self.pack()
> >
> >
> >Why not just use 'class Hello(root)' ? Or have
Quoting Joseph Quigley <[EMAIL PROTECTED]>:
> Hi,
> what's the **kw stand for, used for? What does it mean?
Sorry about that. A couple of people have already answered; I'll just give you
a couple of examples which might help you understand:
>>> def showArgs(**kw):
... print kw
...
>>> s
Quoting Mike Pindzola <[EMAIL PROTECTED]>:
> Should I be even trying to make a system call? Is there a better way to
> talk to the shell? Either way, please enlighten me. Thanks.
There may be a better way to achieve what you want to do, without using the
shell at all. For example, the os and os.
Quoting Joseph Quigley <[EMAIL PROTECTED]>:
> Hi first off, here's my code:
>
> # -*- coding: utf-8 -*-
> from Tkinter import *
> import random
> import time
> import about
> import quotes
>
>
> def closeprog():
> raise SystemExit
>
> class main:
> root = Tk()
> frame = Frame()
> root.titl
Quoting Kevin Reeder <[EMAIL PROTECTED]>:
> What's the significance of naming a variable with a single
> underscore as its first character? For example, I'm looking at
> find.py in the standard library and it has variables named _debug
> and _prune.
Basically, it means "These variables are intern
Quoting Robert <[EMAIL PROTECTED]>:
> I have figured out how to do the math but I need to display these two
> variables with quotation marks around them.
>
> Also I need to add these two variables together and display the
> hexadecimal of these two variables???
>
> Also how do you display wheat
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> I modified the setup.py file to match the details of my game (as best
> I can imagine: I don't know what "optimize = 2 #0,
> 1, or 2; like -O and -OO" means, so I just left it as his sample had
> it,
>From python -h:
-O : optimize generated byteco
Quoting Michael Lange <[EMAIL PROTECTED]>:
> I'm trying to write a python wrapper for the tkDnD Tk extension to add
> drag and drop support
Hi Michael,
Just a side issue --- tkDnD seems to be broken in python 2.4: see bug 1164742,
http://sourceforge.net/tracker/index.php?func=detail&aid=1164742&
Quoting Alan G <[EMAIL PROTECTED]>:
> I don't know the direct answer but the more common way
> of doing that in Python is not to use super() but just
> call the inherited constructor directly:
>
> Parent.__init__(self,'I am a child')
>
>
> SO if you just want to fix the itch use that, if you
Quoting Dave S <[EMAIL PROTECTED]>:
> Turned out that I called the file 'memo.txt', Windows decided it was a
> text file and it ended up as 'memo.txt.txt'. The windows display strips
> anything after the '.', found the problem via dos :)
I recomment going to Windows Explorer -> Folder Options and
Quoting János Juhász <[EMAIL PROTECTED]>:
> That I don't know is the asterisk in zip(*[labels] + rows)
> I wasn't able to find in the python reference what it means.
> May you help me in that ?
You can find it in the language reference: http://docs.python.org/ref/calls.html
Basically, suppose yo
Quoting Andre Engels <[EMAIL PROTECTED]>:
> Is it possible to call a web browser from Python, opening a certain
> page? Preferably the user's standard web browser.
Check the webbrowser module :-)
--
John.
___
Tutor maillist - Tutor@python.org
http:/
Quoting Chuck Allison <[EMAIL PROTECTED]>:
> Hello Tutors,
>
> What would be the most Pythonic way of printing (or extracting) every
> other element of a list? Thanks in advance.
This is probably it:
>>> arr = range(20)
>>> arr[::2]
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
>>> arr[1::2]
[1, 3, 5, 7
Quoting Phillip Hart <[EMAIL PROTECTED]>:
> So far, I've tried using a single Tk window, creating a series of canvas
> widgets, each containing a series of buttons. When pressed, each button
> calls a function which uses .grid_remove() on the current canvas and
> creates a new canvas with new butt
Quoting János Juhász <[EMAIL PROTECTED]>:
>
> Dear Guys,
>
> I have a 2D array:
> >>>[['1', '2 ', '3 '], ['longer ', 'longer ', 'sort']]
>
>
> How can I get what is the max(len(item)) for the columns ?
> I would like to get a list with the max_col_width values.
>
> I hope that, it can wrote w
Quoting Ryan Parrish <[EMAIL PROTECTED]>:
> example -
>
> list_of_classes = ['A', 'B', B', 'A']
>
> class A:
> doingsomething
> class B:
> doing something
>
> for x in list_of_classes:
> x()
>
> my problem is that i get 'TypeError: 'str' object is not callable', of
> which i
Quoting Kevin Reeder <[EMAIL PROTECTED]>:
> The second module is timings.py.
>
> import time, makezeros
>
> def do_timing(num_times, *funcs):
> totals = {}
> for func in funcs: totals[func] = 0.0
> for x in range(num_times):
> for func in funcs:
>starttime = time.time()
>
Quoting Alan G <[EMAIL PROTECTED]>:
> The other waybthat you can use repr() is by using the backtick
> notation
>
> >>> print `s`
> 'hello'
> >>>
It's worth noting that backticks are going out of fashion --- I think they are
queued for deletion in Py3000. Better to get in the habit of just call
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> I'm having a problem with Py2exe.
> I created the executable but when I try to execute it it gives the
> following
> error:
>
> Traceback (most recent call last):
> File "NovusExtension.pyw", line 8, in ?
> File "Pmw\__init__.pyc", line 28, in ?
>
Quoting Mark Kels <[EMAIL PROTECTED]>:
> I want to make a program to lock folders (so the user can only access
> them if he knows the password) under win32, the only problem is that I
> have no idea how to start or what to do. Do you guys have any ideas of
> how to do it?
Is your program going to
Quoting John Carmona <[EMAIL PROTECTED]>:
> The next step is to use the built-in functin ord() in order to convert
> each character to an ASCII integer. I have had a look at the ord() function
> but it says that it only take one argument i.e. ord('a'). How could I
> execute to convert each charact
Quoting Jonas Melian <[EMAIL PROTECTED]>:
> How to know all the exceptions that there are? (i.e. OSError,
> ImportError)
Check the Python library reference (on python.org); section 2.4: Built-in
exceptions.
Of course, you can subclass Exception to build your own!
--
John.
_
Quoting Tom Tucker <[EMAIL PROTECTED]>:
> I am having trouble understanding the c|Pickle modules. What does
> serializing and de-serializing objects mean? I have read the below
> urls and I "think" I understand the process, but I can't visualize the
> beneifts. Can someone kindly explain pickling
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> anyone have a pointer to a *SIMPLE* intro to xml as used in python? I
> looked in the library and there are about 11 xml-related modules.
>
> Perhaps something 'remote'. ;)
Use ElementTree!
(google for it)
--
John.
__
Quoting William O'Higgins <[EMAIL PROTECTED]>:
> I am writing a small application that takes a user through a set of
> steps - like a wizard. What I need is an idea how I can start with a
> window, have the use click "Next" and get another window. My
> understanding is that it is undesirable to ha
Quoting Roger Merchberger <[EMAIL PROTECTED]>:
> I really only need between 500 and 1000 samples per second, but as the
> smallest sleep available normally is time.sleep(.01) -- which brings my
> samples/sec to a nice 100; but I need it a little faster.
Where did you find that out?
> 2) will u
Quoting Shidai Liu <[EMAIL PROTECTED]>:
> Any one know how to make a shutdown, restart, logoff call in windows os
> like 98, 2000 and xp?
Try this: win32api.InitiateSystemShutdown(None, 'Kaboom!', 2000, False, False)
Parameters:
1. Computer to shutdown (None for lcoalhost)
2. Message to displa
Quoting Jonas Melian <[EMAIL PROTECTED]>:
> I'm tryin compare a string with a value with style of pattern-matching.
>
> string = 'i686'
>
> if string == glob.glob(i?86):
This is a task for regular expressions!
Have a look at the re module.
(and feel free to ask for more help if you're having
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> About disabling the button it would be nice to know if that can be done
> , although I made some work around and I managed to restrict the
> Toplevels.
You can disable buttons and menu items with the state option. Setting
state=DISABLED will grey-ou
Quoting Ron Alvarado <[EMAIL PROTECTED]>:
> Is there any way to change this to put in a column of buttons and it
> will scroll like it does now. I've tried but when I put in the buttons the
> scrollbar just grows with all the buttons and won't do anything.
I'm not exactly sure what you're after h
Quoting Mike Hall <[EMAIL PROTECTED]>:
> Does anyone know of a Python debugger that will run under OSX 10.4?
> The Eric debugger was looked at, but it's highly unstable under
> Tiger. Thanks.
pdb should work :-)
--
John.
___
Tutor maillist - Tutor
Quoting Terry Carroll <[EMAIL PROTECTED]>:
> On Tue, 17 May 2005, D. Hartley wrote:
> > This was a hint from a python challenge, but I can't find anything
> > about it online: Anyone know?
> Raymond Hettinger is a frequent contributor to Python. I don't know if
> that is part of it.
If I had to
Quoting Kent Johnson <[EMAIL PROTECTED]>:
> J. Gabriel Schenz wrote:
> > Now, I am new to Python as well, but it seems like apply might not be
> > completely superfluous. I was thinking that if one were using a functional
> > programming style, and had to apply a function determined at runtime to
Quoting Terry Carroll <[EMAIL PROTECTED]>:
> I've recently started using the construct
>
> if __name__ == "__main__":
> main()
>
> And found I can't do the -i thing effectively any more. What's a good
> equivalent approach?
If main is a class, you could change to 'm = main()'; that would at
Quoting Alberto Troiano <[EMAIL PROTECTED]>:
> How can I change the background color of a label??
> How can I change the font-size and make it BOLD??
Check out Fredrik Lundh's _Introduction to Tkinter_:
http://www.pythonware.com/library/tkinter/introduction/
In particular, the section on
Quoting Terry Carroll <[EMAIL PROTECTED]>:
> Suppose I have several variables, e.g.: a, b, c, d, e, f, g.
>
> I would like to be able to see if they're all the same, I don't care
> what the value is, as long as they're equal. If they're all equal to 0, or
> to "spam", or to ["cleese", "idle", "gi
Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>:
> Thanks for this. But do you know how I can achieve a single exe file
> with the dist and build folders. Is it possible to run a single exe file
> without the other dependencies?
There is another freezer here:
http://starship.python.net/crew/atu
Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>:
> I was wondering if someone knows of a better way to make an exe file
> out of python code. I would like to have just one exe file that once you
> run no other windows will pop up other than your application. If you use
> py2exe this will open up a
Quoting Max Noel <[EMAIL PROTECTED]>:
> You mean é? Oh, it is perfectly printable. It's even on my
> keyboard (as unshifted 2), along with è, ç, à and ù. Ah, American
> cultural assumption... ^^
I was waiting for someone to call me on that ...
As was pointed out, I'm not American. I guess th
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> Does anyone have a hint as to what things like this:
> \xaf\x82\r\x00\x00\x01\
>
> refer to?
Basically, they are unprintable characters.
>>> ord('\x82')
130
>>> chr(130)
'\x82'
If you look at http://asciitable.com/, you will see that ascii chracter
Quoting Liam Clarke <[EMAIL PROTECTED]>:
> While we're on challenge 4, I assume a linked list is important. Can
> anyone point me at a good introduction to linked lists?
A linked list, at a high level, is a data structure made of "nodes", where each
node contains some data and a pointer to the n
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> Instances have the following attributes:
>
> filename, comment, etc.
>
>
> I've tried about ten things to get "filename" to work:
>
> myzip.filename("99905.txt") (str not callable)
Check out the error message: "str not callable". You are trying to
Quoting Terry Carroll <[EMAIL PROTECTED]>:
> Is there any way, from within Python, to cause the default browser
> (Firefox, in my case) to be invoked with a specific URL?
If you're on Win32, try:
>>> import win32api
>>> win32api.ShellExecute(0, 'open', 'http://www.google.com/', None, '', 1)
Pa
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> How do I open a zipfile? I see commands for closing it, but i only see
> "class zipfile" - no command like urlopen() (!!!)
Look at the constructor :-)
>>> import zipfile
>>> z = zipfile.ZipFile('myzip.zip')
>>> z.printdir()
...
--
John.
For making a shallow copy of a list, which syntax is preferable:
>>> lst2 = lst1[:]
or
>>> lst2 = list(lst1)
?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Quoting "Jacob S." <[EMAIL PROTECTED]>:
> Unfortunately, after about 50 pages or so, it stops, apparently using
> too much memory, or something causing the computer to lock badly enough I
> have to wait for 5 minutes for the keyboard interupt to work. I believe it
> also hints in the source that I
Quoting Max Noel <[EMAIL PROTECTED]>:
> Apparently, no. I just tried:
>
> >>> b = [i for i in range(10) if (i % 2) == 0 else 0]
You can sometimes do a bit of trickery with and/or. eg:
>>> odds = [(i % 2 == 1 and i or -1) for i in range(10)]
>>> odds
[-1, 1, -1, 3, -1, 5, -1, 7, -1, 9]
The b
Quoting John Clark <[EMAIL PROTECTED]>:
> import sys
>
> def neverEndingStatus(currentChar_ = '|'):
> while 1:
> if currentChar_ == '|':
>currentChar_ = '\\'
> elif currentChar_ == '\\':
>currentChar_ = '-'
> elif currentChar_ == '-':
>currentChar_ = '/'
> elif currentChar_
Quoting Max Russell <[EMAIL PROTECTED]>:
> anyway- I don't like the output which come in the
> form:
> ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
> 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
> 'w', 'x', 'y', 'z', 'a']
>
>
> What I'd like to do is take my list and turn it into
Quoting Max Noel <[EMAIL PROTECTED]>:
> (Also, note that however simple they may seem, one can never
> completely master regular expressions. There are entire books
> dedicated to the things, and when properly used, they're the most
> powerful text processing tool available for any language. In
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> I do have one question, however. I'm on riddle 3 ("re"), and got sent
> to the howto about regular expressions by the hint. But it did not
> seem (at least to me) very user-friendly: or perhaps I'm just not
> applying it to the problem correctly. I can s
As seen on python-announce (via Dr Dobbs):
http://www.pythonchallenge.com/
Good fun!
--
John.
[currently on riddle 6]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Quoting Bernard Lebel <[EMAIL PROTECTED]>:
> aList = [ [], [] ]
>
>
> # Iterate attributes of the top object
> for oAttribute in oObj.attributes:
>
> # Append to list 0 the attribute "type" of the current attribute
> aList[0].append( str(oAttribute.type) )
>
>
Quoting Jeremiah Rushton <[EMAIL PROTECTED]>:
> from Tkinter import *
> from time import sleep
>
> class Main:
>
> def __init__(self,master):
> button = Button(master,text='button')
> button.place(x=1,y=1)
> y=3
> for x in range(1,25):
>sleep(.3)
>button.place_forget()
>butt
Quoting John Carmona <[EMAIL PROTECTED]>:
> Is it that if you use "while 1:" you create a recursive function? Hope I
> am right.
No ...
Remember how functions can call other functions?
def add(x, y):
""" Add two integers together. """
return x+y
def mul(x, y):
""" Multiply two inte
Quoting Jeremiah Rushton <[EMAIL PROTECTED]>:
> In a program that I'm writing in Tkinter, I wanted to know how to
> animate objects. I have three buttons in the beginnig, all in the
> center. I wanted to know how to, when the user clicks one of them,
> make them small and move to a top corner and
Quoting "Ertl, John" <[EMAIL PROTECTED]>:
> top = Tkinter.Toplevel(app,visual="truecolor",colormap="new")
> top.title(mainTitle)
> top.protocol("WM_DELETE_WINDOW", quit)
> top.bind("",quit)
> top.bind("",quit)
In addition to Michael's comments, to bind to a keypress, you just do (eg)
widget.
Quoting "D. Hartley" <[EMAIL PROTECTED]>:
> The play file does end in ".py". I am running it on Windows. You can
> double-click the play file, and run it straight that way, which is
> when the crash occurs. If you right click the file, go to "edit in
> IDLE", and hit F5 to run it, the crash does N
Quoting Max Noel <[EMAIL PROTECTED]>:
> On Apr 15, 2005, at 01:33, D. Hartley wrote:
> > (I also
> > just ended up writing the list like [score,user] because I couldnt
> > figure out how to get it to sort by the second half of the tuple. I
> > need a better tutorial book, I think!)
> I'm sti
Quoting "Gooch, John" <[EMAIL PROTECTED]>:
> I am writing a function whose job is it delete all of the selected items
> in a Listbox.
I think this problem is the same as the general problem of deleting a selection
of items from a python list. The general solution is to iterate through the
list o
Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>:
> If this is too general a question, perhaps you can tell me when NOT to
> use recursion(where it would be inappropriate or inefficient).
In my opinion ---
Some problems are naturally recursive. A good example is traversing data
structures (parti
Quoting Luke Jordan <[EMAIL PROTECTED]>:
> But this does not:
>
> def aFunc(configArg):
> print "aFunc with argument"
> print configArg
>
> def anotherFunc(configArg):
> print "anotherFunc with argument"
> print configArg
> return aFunc,1
^^
> def dispatch(func,configArg
Quoting Joseph Quigley <[EMAIL PROTECTED]>:
> prefixes = 'JKLMNOPQ'
> suffix = 'ack'
>
> for letter in prefixes:
> if letter == ('O') or ('Q'):
> print letter + 'u' + suffix
> else:
> print letter + suffix
Hi Joseph,
This still won't work. The reason is that your if statement is
A couple of options...
You can pack a scrollbar on the right hand side of the containing frame and use
the yscrollcommand option to associate it with the frame --- see Fredrik Lundh's
Tkinter pages for an example.
Or you could grab Python MegaWidgets from http://pmw.sourceforge.com/ and use a
Pmw
Quoting Kent Johnson <[EMAIL PROTECTED]>:
> This is a hard problem. It is a version of the "0-1 knapsack problem" -
> googling for that might give
> you some ideas.
> > Hi
> > Some of my harddrives are getting full and i would like to burn the files
> > to
> > some cheep DVD's. Filesizes range
Quoting Kenny Li <[EMAIL PROTECTED]>:
> A little while ago, when I tried to pick up Python, I ran into an
> article that has a script to add up all numbers in a text file (email
> message, for example). I want to use that script now, but I could not
> find (recalled) the URL to the article. If you
1 - 100 of 135 matches
Mail list logo