Re: Find and Delete all files with .xxx extension

2006-07-12 Thread John McMonagle
On Wed, 2006-07-12 at 16:12 -1000, normt's subject read: > Find and Delete all files with .xxx extension How ? In the current directory/folder ? Recursively search through all the directories/folders from a certain path ? I suggest you look at the os module (section about Files and Directorie

Re: Tkinter StringVar mystery

2006-07-17 Thread John McMonagle
On Mon, 2006-07-17 at 15:00 -0600, Bob Greschke wrote: > First off I have this class (thanks to whoever came up with this way back > when): > > ## > # BEGIN: class Command > # LIB:Command():2006.110 > #Pass arguments to functions from button presses and menu selections, >

Re: execute a shell script from a python script

2006-07-17 Thread John McMonagle
On Mon, 2006-07-17 at 16:59 -0700, spec wrote: > Thanks, actually there are no args, is there something even simpler? > > Thanks > Frank > > > Thomas Nelson wrote: > > If your script is foo.sh and takes args: > > import subprocess > > subprocess.call(["foo.sh","args"],shell=True) > > Should work

Re: tkinter help

2006-07-18 Thread John McMonagle
On Tue, 2006-07-18 at 08:37 -0700, groves wrote: > hi eveyrbody , i have started working on python tkinter, > While I was working on one of the tkinter classes..named listbox > widget. I had a slight problem. > > Now let me tell you that i was able to create a simple listbox which > had 6 options

Re: Tkinter focus_set use with grid

2006-07-19 Thread John McMonagle
On Thu, 2006-07-20 at 02:53 +, Stan Cook wrote: > A newbie to Tkinter here. . . . . . > > I'm trying to set the focus on an Entry textbox with > focus_set. I am using the grid manager. I created the same > interface before using the pack() method and the focus_set > worked, but now it sa

Re: Help in string.digits functions

2006-07-24 Thread John McMonagle
On Mon, 2006-07-24 at 22:19 -0700, Anoop wrote: > Hi All > > I am getting two different outputs when i do an operation using > string.digits and test.isdigit(). Is there any difference between the > two. I have given the sample program and the output > > Thanks for ur inputs > > Anoop > > #1: >

Re: webbrowser open failing

2006-07-26 Thread John McMonagle
On Wed, 2006-07-26 at 17:09 +1200, Thomas wrote: > Hi all, > > I am getting an error using webbrowser open on mac 10.3 using python > 2.3.5 > > >>> test=open("/Volumes/TINTZ;P3/DT Hot Folder > test/Justin_Test.pDF","r") > >>> type(test) > > >>> webbrowser.open("/Volumes/TINTZ;P3/DT Hot Fo

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-26 Thread John McMonagle
On Wed, 2006-07-26 at 20:18 -0700, John Machin wrote: > [EMAIL PROTECTED] wrote: > > I know this is a trivial function, and I've now spent more time > > searching for a surely-already-reinvented wheel than it would take to > > reinvent it again, but just in case... is there a published, > > open-so

Re: how best to check a value? (if/else or try/except?)

2006-07-27 Thread John McMonagle
On Thu, 2006-07-27 at 20:44 +, John Salerno wrote: > My code is below. The main focus would be on the OnStart method. I want > to make sure that a positive integer is entered in the input box. At > first I tried an if/else clause, then switched to try/except. Neither is > perfect yet, but I

Re: update a window with tkinter ...

2006-07-27 Thread John McMonagle
On Thu, 2006-07-27 at 19:56 +0200, Laurent Hermann wrote: > Hi I'm new on this list so let me say hello to everybody. > > > I have a little problem with tkinter but I could not find the solution > on the net so I ask it here... > > > The thing I want to do is simple but I cannot, I would like t

Re: Working with Widget after Instance loses the reference

2006-07-31 Thread John McMonagle
On Mon, 2006-07-31 at 11:15 -0700, Al in Dallas wrote: > I made the mistake of creating an instance of a widget and assigning it > to a name I'd already used. Now, if I use root.children or > root.slaves(), I can see the "lost" widget, but can I do anything else > with the string of numbers that sh

Re: two embedded problem. one maybe is python bug.

2006-08-03 Thread John McMonagle
On Fri, 2006-08-04 at 11:10 +0800, yy x wrote: > hi,all, > > > > the content of a.py : > #coding:gb2312 > #/usr/local/bin/python > import random > print random.randint(0,10) > > the c program: > #include > int main() > { > Py_Initialize(); > PyRun_SimpleString("import sys")

Re: using python at the bash shell?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 21:03 -0400, John Salerno wrote: > Hi all. I just installed Ubuntu and I'm learning how to use the bash > shell. Aside from the normal commands you can use, I was wondering if > it's possible to use Python from the terminal instead of the normal bash > commands (e.g. print

Re: Import module with non-standard file name

2006-08-07 Thread John McMonagle
On Tue, 2006-08-08 at 11:06 +1000, Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with n

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 15:41 +0200, Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > Here's how I do it: Firstly, I create a file called imports.py which contains all my import s

Re: How to find out the directory that the py file is in?

2006-10-24 Thread John McMonagle
On Wed, 2006-10-25 at 02:49 +0100, Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > > > On Oct 24, 7:01 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > >>At Tuesday 24/10/2006 20:39, [EMAIL PROTECTED] wrote: > >> > >> > >>>I have the following python script and some_command in the same >

Re: Tkinter: Strange behavior using place() and changing cursors

2006-11-14 Thread John McMonagle
Mudcat wrote: > Is there something I'm supposed to do in order > to prevent this from happening? Yes. Instead of configuring the cursor on the frame, do it on the master: self.master.configure(cursor='sb_h_double_arrow') -- This message has been scanned for viruses and dangerous content by

Re: TIming

2006-05-29 Thread John McMonagle
Tue, 2006-05-30 at 00:23 -0500, WIdgeteye wrote: > On Tue, 30 May 2006 04:34:03 +, Tim Roberts wrote: > > > WIdgeteye <[EMAIL PROTECTED]> wrote: > >>HI, > >>I am trying to write a little program that will run a program on scedule. > >>I am having trouble understanding the datetime, time, sched

Re: Tkinter question

2006-05-31 Thread John McMonagle
On Wed, 2006-05-31 at 11:37 -0400, david brochu jr wrote: > I am trying to create a GUI that will display a new window with > information about my program when the user clicks on the info button > (a green "i" bitmap). So far all I can get my program to do is show > the new window (using Toplevel()

Re: beginner: using parameter in functions

2006-05-31 Thread John McMonagle
On Wed, 2006-05-31 at 23:24 +, 3rdshiftcoder wrote: > hi- > > i am having trouble using parameter values in my function and to be honest a > little trouble with > member variables. i am trying to pass in the argument 'd' representing > delete. > what the code will do is if it is 'd' it will

Re: Tkinter - changing existing Dialog?

2006-06-01 Thread John McMonagle
On Thu, 2006-06-01 at 08:31 -0400, Michael Yanowitz wrote: > Hello: > > >I have a Tkinter GUI Dialog with many buttons and labels and text > widgets. > What I would like to do is, can I: > > 1) Disable/deactivate/hide a button, text widget that is already drawn (and >of course the opposi

Re: tkinter: making widgets instance or not?

2006-06-06 Thread John McMonagle
On Tue, 2006-06-06 at 19:42 +, John Salerno wrote: > Fredrik Lundh wrote: > > > however, if you need to access a widget later on, it might be a good > > idea to save a reference to it somewhere... > > To follow up on that point, I have the following code now. I have two > questions about it

Re: tkinter: making widgets instance or not?

2006-06-06 Thread John McMonagle
On Wed, 2006-06-07 at 09:27 +1000, John McMonagle wrote: > On Tue, 2006-06-06 at 19:42 +, John Salerno wrote: > > Fredrik Lundh wrote: > > > > > however, if you need to access a widget later on, it might be a good > > > idea to save a reference to it some

Mouse wheel event for Canvas

2006-06-21 Thread John McMonagle
I tried binding mouse wheel events (, ) to a Tkinter Canvas widget with the hope of using the event.delta value to subsequently scroll the Canvas. However, it seems that event.delta always returns 0. For example, from Tkinter import * r = Tk() c = Canvas(r, scrollregion=(0,0,500,500), height=20

Re: Mouse wheel event for Canvas

2006-06-22 Thread John McMonagle
On Thu, 2006-06-22 at 14:24 +1000, John McMonagle wrote: > I tried binding mouse wheel events (, ) to a Tkinter > Canvas widget with the hope of using the event.delta value to > subsequently scroll the Canvas. > > However, it seems that event.delta always returns 0. > > F

Re: eval() woes

2006-08-28 Thread John McMonagle
On Mon, 2006-08-28 at 21:13 -0700, rdrink wrote: > > (BTW, as a footnote: For each of the above 'equations' the function > equate() was called 500 times... in some cases with the list 'parts' > equaling things like ['0',2','3','0'], so I have no reason to believe > that the problem is with the wa

Re: tkinter text event

2006-09-06 Thread John McMonagle
On Wed, 2006-09-06 at 17:54 -0700, Jay wrote: > I'm having trouble with using the event with the Text object. > When I use them together (which is a logical combination), I use this > code: > > textbox = Text(root, wrap="word", height=15, width=50) > textbox.bind("", resolveGlyphs) >

Re: wxPython: StaticText Event

2006-09-07 Thread John McMonagle
> Hovering mouse over the StaticText Control should generate an > EVT_ENTER_WINDOW event like the TextCtrl Control, but it does not happen. > > How can I make the StaticText event working? > According to the book "wxPython In Action", page 186: "One feature that you cannot see from just the fi

Re: split string problems

2006-09-07 Thread John McMonagle
On Thu, 2006-09-07 at 16:21 -0700, Tempo wrote: > [ > $14.99 > , > $27.99 > , > $66.99 >

Re: Delete items in nested dictionary based on value.

2006-09-13 Thread John McMonagle
> > Assuming dict_sweep worked perfectly it would take input like this: > > A_in = {1: {2: 2, 3: {1: None, 2: 2}}, 2: 2, 3: None} > > B_in = {1: {1: {1: None, 2: {1: None}}, 2: 2, 3: None} > > and output this: > > A_out = {1: {2: 2, 3: {2: 2}}, 2: 2} > > B_out = {2:2} > > This dict_sweep ab

Re: No output from popen in Tkinter text widget

2006-12-11 Thread John McMonagle
Kevin Walzer wrote: > I'm trying to display the output of an external process (invoked via > popen) in a Tkinter text widget. I successfully start the process (based > on what I'm seeing in my terminal output), but I can't get the output to > display in the Tkinter widget. It seems to block. > > A

Re: Need Simple Way To Determine If File Is Executable

2006-12-14 Thread John McMonagle
Tim Daneliuk wrote: > I have a program wherein I want one behavior when a file is set as executable > and a different behavior if it is not. Is there a simple way to determine > whether a given named file is executable that does not resort to all the > lowlevel ugliness of os.stat() AND that is po

Re: how to parse structured text file?

2006-01-31 Thread John McMonagle
+ 1 outString = '(' + items.get('objStartId') + ',' + items.get('eventName') + ',' + items.get('eventCond') + ',' + items.get('eventAction') + ',' + items.get('objEndId') + ')\n&

Re: nDimensional sparse histogram in python.

2006-02-01 Thread John McMonagle
On Wed, 2006-02-01 at 19:06 -0800, KraftDiner wrote: > Cool. > Ok so my histogram class had two methods 1) To increment a point and 2) > to get the point. > > def class histo: >def __init__(self): >histo = {} > def update(point): >'''searches the dictionary for point and if it exis

Re: Natural Language Date Processing.

2006-02-09 Thread John McMonagle
On Thu, 2006-02-09 at 09:47 +0100, Michael Amrhein wrote: > Andrew Gwozdziewycz schrieb: > >> You may take a look at http://labix.org/python-dateutil > >> Have fun > >> Michael > >> > > > > Looks like it does a good job parsing dates, but doesn't seem to do > > english dates. I found a javascript

Determining an operating system's default browser

2006-02-09 Thread John McMonagle
owser when selected from the application's Help menu If python can determine the path to the default browser, I can then just spawn it. Regards, John McMonagle -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.

Re: Determining an operating system's default browser

2006-02-09 Thread John McMonagle
On Thu, 2006-02-09 at 17:53 -0600, Larry Bates wrote: > You don't have to determine it. Just os.startfile('page1.html') > and let the OS figure it out. Works great for Windows - not available on Unix though. -- This message has been scanned for viruses and dangerous content by MailScanner, an

Re: Basic coin flipper program - logical error help

2006-02-21 Thread John McMonagle
On Tue, 2006-02-21 at 16:14 -0800, DannyB wrote: > I'm just learning Python. I've created a simple coin flipper program - > here is the code: > > [source] > #Coin flipper > import random > > heads = 0 > tails = 0 > counter = 0 > > coin = random.randrange(2) > > while (counter < 100): > if

Re: Tix, spinboxes, and 1>=5

2006-02-22 Thread John McMonagle
On Wed, 2006-02-22 at 18:37 -0800, [EMAIL PROTECTED] wrote: > This odd bug has been annoying me for several days now. I finally got > round to making this, frankly hilarious, testcase: > > > from Tix import * > > def sayfive(num): > if num<5: print num,"< 5" > else: print num,">= 5" > >

Re: Where did my post go?

2007-04-25 Thread John McMonagle
[EMAIL PROTECTED] wrote: > I posted to this newsgroup earlier about my annoyances with python and > now I can't find the post. What did you do with it? > How "annoying". Seriously though, I saw it - delivered at 8:50 AEST. -- http://mail.python.org/mailman/listinfo/python-list

Re: {Possible_Spam} tkFileDialog.askopenfilename()

2007-05-15 Thread John McMonagle
[EMAIL PROTECTED] wrote: > Hi, > When I call tkFileDialog.askopenfilename() , the dialog box opens with > the current directory as the default directory. Is it possible to open > the dialog box with a directory other than the current directory. Can > we pass in a user defined starting directory. >

Re: Tkinter help, please...

2007-05-24 Thread John McMonagle
I've made a couple of minor changes to your code from the Cribbage class down: class Cribbage: def __init__(self, win): self.parent = win# < make the toplevel Tk window an # < attribute of the class #Draw the interface

Re: Error with Tkinter and tkMessageBox

2007-08-01 Thread John McMonagle
Fabio Z Tessitore wrote: > hi all, > > this Tkinter very simple code work fine: > > ## > from Tkinter import * > > win = Tk() > win.mainloop() > ## > > but if I try to open a message box, it happens: > > Exception in Tkinter callback > Traceback

Re: Error with Tkinter and tkMessageBox

2007-08-02 Thread John McMonagle
Fabio Z Tessitore wrote: > I've tried to use Twm and SURPRISE! it works!!! > > Can you say why? How can I fix the prob with Gnome? > > Thanks I don't know why it doesn't work correctly on the version of gnome which you are running (I run KDE). Perhaps the question needs to be posed to a gnome

Re: creating a tar file with python

2007-08-23 Thread John McMonagle
Brian McCann wrote: > Hi, > > I'm trying to create a tar file of the contents of the current directory > > right now there is only one file "text.xml" in the current dir, I'm > using"." current dir as source > but that gives syntax error > > any help would be greatly appreciated > --Brian >

Re: {Possible_Spam} tkinter text editor

2007-03-08 Thread John McMonagle
Gigs_ wrote: > I'm writing text editor. > > How to enable/disable (cut, copy etc.) when text is selected/not selected Bind the Button1-ButtonRelease event to a function which checks the length of the SEL tag of the text widget. If it is zero length, disable the appropriate menu entries, if it

Re: {Possible_Spam} Re: {Possible_Spam} tkinter text editor

2007-03-09 Thread John McMonagle
-- Original Message --- From: Gigs <[EMAIL PROTECTED]> To: John McMonagle <[EMAIL PROTECTED]> Sent: Sat, 10 Mar 2007 15:13:20 +0100 Subject: {Possible_Spam} Re: {Possible_Spam} tkinter text editor > John McMonagle wrote: > > Gigs_ wrote: > &g

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread John McMonagle
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > ---

Re: PMW widget - skip tabbing to it

2007-03-26 Thread John McMonagle
jp wrote: >>> On Mar 26, 10:51 am, "jp" <[EMAIL PROTECTED]> wrote: I have multiple PMW widgets (EntryFields, ScrolledField etc), how can I skip over these widgets when using the tab key? Thank you, John What version of Pmw are you using ? Tabbing between widgets works fine o

Re: Associate image name with list item

2007-03-26 Thread John McMonagle
Kevin Walzer wrote: > I'm trying to avoid a *lot* of typing in my Tkinter application by > associating image names with items in a list. Here is my sample list: > > self.catlist = [ > 'all', 'installed', 'base', 'crypto', 'database', 'devel', > 'editors', 'games', 'gnome', '

Re: help with radionbutton

2007-03-26 Thread John McMonagle
Sang Park wrote: > how do I select radionbutton by default? > for my school project, I need to have 10 radio buttons and have half of > them selected > I have > for i in range(10): > x = IntVar() > if i < 5: > rb = Radiobutton(buttonFrame, variable=x, value=1,state=DISABLED) > else: > rb = Radiob

Re: Tkinter, how to get a button's bg color

2007-04-03 Thread John McMonagle
[EMAIL PROTECTED] wrote: > I am new to Tkinter. Following an example, I executed the following: > > window = Tk() > b = Button(window) > b.configure(bg = '#FF00FF') > b.grid(row = 0, column = 0) > > how can I later get the value of this button's background color? > > Thanks. > b.cget('bg')

Re: Python - why don't this script work?

2007-10-22 Thread John McMonagle
Ohmster wrote: > I am trying to use this cool script that some MIT guy wrote and it just > does not work, I get a stream of errors when I try to run it. It is > supposed to visit a URL and snag all of the pictures on the site. Here is > the script: > http://web.mit.edu/pgbovine/www/image-harvest

Re: Tkinter __call__

2007-02-15 Thread John McMonagle
Gigs_ wrote: > from Tkinter import * > from tkFileDialog import askopenfilename > from tkColorChooser import askcolor > from tkMessageBox import askquestion, showerror > from tkSimpleDialog import askfloat > > demos = { > 'Open': askopenfilename, > 'Color': askcolor, > 'Query':

Re: Tkinter--unexpected behavior with pack_forget()

2007-12-20 Thread John McMonagle
Kevin Walzer wrote: > I'm trying to toggle the visibility of a Tkinter widget using > pack_forget(), and I'm running into unexpected behavior. The widget > "hides" correctly, but does not become visible again. My sample code is > below: > > > from Tkinter import * > > root = Tk() > > lab

Re: Image open problem

2006-04-19 Thread John McMonagle
On Thu, 2006-04-20 at 10:29 +1000, John Machin wrote: > On 20/04/2006 6:55 AM, Aleksandar Cikota wrote: > > Hi all, > > > > I have a problem with openning of an image. > > > > Here is the Code: > > > > from Tkinter import * > > from PIL import Image, ImageTk Change from PIL import Image, ImageT

Re: Tabs versus Spaces in Source Code

2006-05-14 Thread John McMonagle
Personally, I don't think it matters whether you use tabs or spaces for code indentation. As long as you are consistent and do not mix the two. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/li

Re: The stange behaviour of Tkinter.Canvas

2008-03-11 Thread John McMonagle
James Yu wrote: > I tried to update the rectangle on a canvas to get the visual effect of > progressbar. > It works all right if I delete the existing objects (rectangle and text) > and create a new one. > However, if I invoke canvas.itemconfig() to update the existing objects' > options, gui just

Re: Getting screen dims platform specific? Say it ain't so!

2009-02-24 Thread John McMonagle
Lionel wrote: > Yes, it's platform specific. I was just trying anyway to see if it > would work. > > In a nutshell, what I need is a way to acquire the screen dimensions > (in pixels) and its dpi setting. This should work on all platforms: from Tkinter import * r = Tk() r.withdraw() r.winfo_scre

Re: tkinter: loading file before entering mainloop

2009-03-15 Thread John McMonagle
Peter Billam wrote: > On 2009-03-14, Peter Otten <__pete...@web.de> wrote: >> Well, I don't know where the ymid[...] values come from. If you can >> guarantee that ymid[track_num] - ymid[track_num-1] > 50 at some point >> you could reschedule loadFile() from within loadFile() and return >> immediat

Re: How to query object of GUI?

2009-04-14 Thread John McMonagle
Muddy Coder wrote: > Hi Folks, > > I need to query the ID of GUI, in Tkinter, but don't know how to do > it. This is my code: > > calss MyGUI: > >def make_menu(self): > top = Menu(self) > menObj = Menu(top) > labels = read_from_database() > for lab in label

Re: rectangles, or cavases, or ... ?

2009-04-20 Thread John McMonagle
Alan G Isaac wrote: > I need to display many (e.e., 2000) small squares whose colors are udpated > each time a computation is complete. > > One approach is to put rectangles on a single canvas. > Another approach is to put many canvases in a single frame. > Another approach is to create an image e

Re: this worked before...' '.join([`x x` for x in range(1, 6)])

2008-05-19 Thread John McMonagle
[EMAIL PROTECTED] wrote: > ' '.join([`x x` for x in range(1, 6)]) > > anyone can tell me what im doing wrong? > -- > http://mail.python.org/mailman/listinfo/python-list > ' '.join(['%s %s' % (str(x), str(x)) for x in range(1,6)]) or ' '.join([str(x)+' '+str(x) for x in range(1,6)]) outputs

Re: Problem with a for loop and a list

2008-07-02 Thread John McMonagle
Alexnb wrote: > well okay, so what can I do? > > > Firstly, stop top posting. Replies to a thread "flow" better if bottom posted. Secondly, it sounds like you want to build a list of the results from your entry.get() calls. Try this: self.wordList = [] def getWords(self): for entry in se

Re: a simple 'for' question

2008-07-08 Thread John McMonagle
Ben Keshet wrote: > Hi fans, > > I want to use a 'for' iteration to manipulate files in a set of folders, > something like: > > folders= ['1A28','1A6W','56Y7'] > for x in folders: >print x # print the current folder >f = open('my/path/way/x/my_file.txt', 'r') >... > Use os.path.

Re: string[i:j:k]

2008-07-21 Thread John McMonagle
konstantin wrote: > > Thanks! > It seems that negative step leads in reverse direction. > But logic isn't completely clear for me. s = '123456789' s[::-2] > '97531' > > but s[:-1:-2] > '' > though I expected something like '8642' > What did i missed? > > -- You need to *start*

Re: Help with a reverse dictionary lookup

2006-03-09 Thread John McMonagle
On Thu, 2006-03-09 at 15:51 -0800, rh0dium wrote: > Hi all, > > I have a dict which looks like this.. > > dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']}, > '180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc': > ['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']}, > '250nm': {'umc': ['2p6m_1.8-3.

Re: Password entering system

2006-03-09 Thread John McMonagle
On Thu, 2006-03-09 at 19:42 -0800, Tuvas wrote: > Thanks, that's exactly what I wanted! > > -- > http://mail.python.org/mailman/listinfo/python-list > You may also want to check out Pmw (Python Megawidgets) Pmw has a nifty Prompt Dialog. See http://pmw.sourceforge.net/doc/PromptDialog.html

Multiplying all the values in a dictionary

2006-03-23 Thread John McMonagle
Say I have a dictionary like below: d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]} Say I want to multiply all the values of the dictionary by 2: for key in d.keys(): d[key] = map(lambda x: x*2, d.get(key)) Is there a better/faster/cleaner way to achieve this ? Thanks, John -- Th

Re: Mouse event - binding

2006-04-04 Thread John McMonagle
ur) where changeColour is a function like so: def changeColour(self, event): x = self.draw.canvasx(event.x) y = self.draw.canvasy(event.y) item = self.draw.find_closest(x,y) currentColour = self.draw.itemcget(item, 'fill') if currentColour == 'red': self.draw.itemconfigure(item, fill='blue') else: self.draw.itemconfigure(item, fill='red') This will toggle the ball colour between red and blue. HTH, John McMonagle -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter canvas

2006-04-04 Thread John McMonagle
7;, moveRect) canvas.tag_bind('rect', '', finishMove) Now when you click on a canvas item with a 'grid' tag nothing will happen, but if you click on a canvas item with a 'rect' tag you will invoke the appropriate function. HTH, John McMonagle -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter canvas

2006-04-04 Thread John McMonagle
27;,tags='rect') c.create_rectangle(320,210,415,290,fill='#00FF00',outline='#00FF00',tags='rect') c.create_rectangle(400,50,450,100,fill='#00',outline='#00FFFF',tags='rect') # bind rect tags to move functions c.tag_bind('

Re: Mouse event - binding

2006-04-05 Thread John McMonagle
On Wed, 2006-04-05 at 09:21 -0700, beta wrote: > Dear John, > > Thanks for your help. I don't know how to bind the ball only into a > program. Would you mind help me on this? I added the changeColour > function, here is a complete program. ...SNIP code... Add the following code after you draw t

Re: Mouse event - binding

2006-04-05 Thread John McMonagle
On Wed, 2006-04-05 at 16:04 -0700, beta wrote: > Hi John, > > It don't work! > I did what you told me, here is theBall function > > def theBall(self): > self.ball = self.draw.create_oval("0i", "0i", "0.20i", > "0.20i", > fill="red") > se

Re: Mouse event - binding

2006-04-05 Thread John McMonagle
On Wed, 2006-04-05 at 16:04 -0700, beta wrote: > Hi John, > > It don't work! > I did what you told me, here is theBall function > > def theBall(self): > self.ball = self.draw.create_oval("0i", "0i", "0.20i", > "0.20i", > fill="red") > se

Re: binding - python

2006-04-05 Thread John McMonagle
Quoc, the following code, verbatim, works for me: from Tkinter import * class Pong(Frame): def createWidgets(self): self.QUIT = Button(self, text='QUIT', foreground='red', command=self.quit) self.QUIT.pack(side=LEFT, fill=BOTH) ## The playi

Re: How to create a tear off menu in TKinter. Help Needed

2006-04-06 Thread John McMonagle
u and use tearoff option testmenu = Menu(editmenu, tearoff=1) testmenu.add_command(label='option1') testmenu.add_command(label='option2') # add the sub menu to the editmenu editmenu.add_cascade(label='test', menu=testmenu) # Add the edit menu to the menu bar m.add_ca

Re: binding - python

2006-04-06 Thread John McMonagle
You will also need to initialise the self.oldspeed variable when you first create the Scale widget. John McMonagle -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread John McMonagle
n00m wrote: > On Nov 27, 5:24 am, astral orange <457r0...@gmail.com> wrote: > [skip] > > How about the next problem: > you are given string "s" (len(s) <= ~1), in the string only > letters 'a'..'z' > Task: to count the number of all *different* substrings of "s" > > Example: > s = 'abbaz' > I

Re: Display file names in Tkinter Listbox

2010-05-19 Thread John McMonagle
r...@home.com wrote: > Hello, > > My first attenpt at a simple python Tkinter application. I wanted to > see how to load file names into a listbox from a menu. This is what I > got until the part of displaying the file names in a listbox, which I > could not figfure out how to do? > > Any help w

Re: Display file names in Tkinter Listbox

2010-05-20 Thread John McMonagle
s...@home.com wrote: > I have made the modifications and it does print inside the listbox, > however they are all printed on the same line. > Sorry, I didn't realize askopenfilenames returned the filenames as a whitespace separated string, on my system they are returned as a tuple of strings.

Re: Tkinter / Entry widget problem

2009-07-14 Thread John McMonagle
Andras Szabo wrote: > Hello. I searched the archives but couldn't find a solution to a problem > related to the Entry widget in Tkinter. > > When creating a pop-up window in an app, which contains an Entry widget, > I want this widget to contain some default string, to have all this > default stri

Re: Python documentation too difficult for beginners

2010-11-02 Thread John McMonagle
//www.google.com/search?sitesearch=docs.python.org&q=open Regards, John McMonagle -- http://mail.python.org/mailman/listinfo/python-list