Re: Using Which Version of Linux
Jeffrey Schwab wrote: > > I might get lambasted for suggesting this, but try Slackware. It will > let you do a very minimal installation, which means there's less stuff > that can go wrong. It also has nice, beginner-friendly FAQs to help you > get started. Like the other distros already suggested, it comes with > the graphical desktop environments Gnome and KDE, too. What I like about Slackware/python is that you get the full python distribution. My last experience with Debian & subordinates was that only the "core" python was included with the distribution, and a bit of hunting was required to get Tkinter working. Maybe this has improved in the last year or two? Nick -- http://mail.python.org/mailman/listinfo/python-list
Tkinter from Vis. BASIC
In VB, an easy way I indicate progress is something like do while lblNotify.foreground = randomcolor lblNotify.refresh <--- loop I want to do the same thing in Python/Tkinter: # Wait for network to recognize the workstation: while os.system("slist") != 0: self.notify["fg"] = randcolor() # how do I refresh label l3 at this point? time.sleep(3) I've tried self.notify.grid() (I'm using the grid geometry manager throughout), but that didn't work, and there is no redraw() or refresh() method that I can see. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter from Vis. BASIC
[EMAIL PROTECTED] wrote: >>I want to do the same thing in Python/Tkinter: >> >> # Wait for network to recognize the workstation: >> while os.system("slist") != 0: >> self.notify["fg"] = randcolor() >> # how do I refresh label l3 at this point? >> time.sleep(3) > I know of an update_idletask() method, look it up in the tkinter doc to > see if that's what you need! > Thanks. I did a dir(label_object) and saw update() and update_idletasks(). updeate() seems to do the trick. -- http://mail.python.org/mailman/listinfo/python-list
System Independent Wallpaper Changer
This is what I've got... the code should work on a typical Windows system, I think... import os import random import time # I'm not sure what to expect for Win98, WinME, etc. I've # only tried it with xp... if os.name in ['nt', 'win98', 'me']: osWindows = True import ctypes import win32con import Image pth = 'c:/path/to/wallpapers' else: osWindows = False pth = '~/path/to/wallpapers' picfiles = os.listdir(pth) while True: jpg = random.choice(picfiles) if os_type = 'W': bmp = 'c:/wallpaper.bmp' Image.open(pth+jpg).save(bmp) cs = ctypes.c_buffer(bmp) ok = ctypes.windll.user32.SystemParametersInfoA(win32con.SPI_SETDESKWALLPAPER,0,cs,0) else: pass ' set kde wallpaper to jpg <- *** --- time.sleep(60) = I've done some searching, and can't seem to find a programatic way of getting *** that to happen. Thanks for any advice. Nick. -- http://mail.python.org/mailman/listinfo/python-list
Re: System Independent Wallpaper Changer
Toby Dickenson wrote: > On Wednesday 06 July 2005 01:12, Terrance N. Phillip wrote: > > >>I've done some searching, and can't seem to find a programatic way of >>getting *** that to happen. > > > http://www.google.com/search?q=setwallpaper+dcop > > I hope this helps > That helps very much, thank-you! And sorry to previous posters: yes, indeed, I changed naming conventions part way through--you got an intermediate version. Nick. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem loading a file of words
Kevin, I'm pretty new to Python too. I'm not sure why you're seeing this problem... is it possible that this is an "out-by-one" error? Is zymotechnics the *last* word in dictionary.txt? Try this slightly simplified version of your program and see if you have the same problem def sort_string(word): '''Returns word in lowercase sorted alphabetically''' return "".join(sorted(list(word.lower( dictionary = {} f = open('/usr/bin/words') # or whatever file you like for line in f: sline = sort_string(line[:-1]) if sline in dictionary: dictionary[sline].append(line) else: dictionary[sline] = [line] f.close() lookup = raw_input('Enter a scrambled word : ') while lookup: try: results = dictionary[sort_string(lookup)] for x in results: print x, print except: print "?" lookup = raw_input('Enter a scrambled word : ') Good luck, Nick. -- http://mail.python.org/mailman/listinfo/python-list
Parallel arithmetic?
Given a and b, two equal length lists of integers, I want c to be [a1-b1, a2-b2, ... , an-bn]. I can do something like: c = [0] * len(a) for ndx, item in enumerate(a): c[ndx] = item - b[ndx] But I'm wondering if there's a better way, perhaps that avoids a loop? Nick. (I seem to recall from my distant past that this sort of thing was dead easy with APL... c = a-b, more or less.) N -- http://mail.python.org/mailman/listinfo/python-list
Re: Parallel arithmetic?
Thank-you very much for all the excellent replies. I'm thinking of using this to determine if a sequence is a "run" (as in a card game). If I've got a sorted hand [3, 4, 5, 6, 7], then I know I've got a 5-card run because [4, 5, 6, 7] - [3, 4, 5, 6] == [1, 1, 1, 1]. I want to avoid something like if h[0] == h[1]-1 and h[1] == h[2]-1 ... Nick. -- http://mail.python.org/mailman/listinfo/python-list