hi all
i recently wrote a script that implements a puzzle. the interface
mostly consists of a bunch of colored disks on a tkinter canvas. the
problem is that the disks change their colors in ways other than the
way they're supposed to. it certainly isn't just a bug in my script,
since i can someti
i'm using the canned colors ("pink", "orange", etc). should i try
changing to explicit color specifications to see if that makes a
difference? i'm not sure what the other guy meant by a "soft toy", but
i take it the idea is to try and construct a correctness proof for the
script, and see what keeps
hi ron
changing from english words to hexadecimal numerals did the trick for
me, so everything's cool now. thanks for looking at it.
peace
--
http://mail.python.org/mailman/listinfo/python-list
While fiddling with a little script I ran into a problem that baffles
me completely. Maybe I'm missing something completely obvious, and
somebody out there can diagnose the problem at a glance. Anyway,
that's the hope. Here's the code (it plays tic tac toe):
"""
Something goes wrong with the "tim
I recently found out that unicode("\347", "iso-8859-1") is the
lowercase c-with-cedilla, so I set out to round up the unicode numbers
of the extra characters you need for French, and I found them all just
fine EXCEPT for the o-e ligature (oeuvre, etc). I examined the unicode
characters from 0 to 90
I'd like to save one Tkinter Canvas in order to use it on another
Canvas later. The problem is that it gets saved as EPS but it needs to
be GIF to be reuseable. How can I convert that format?
Peace,
STM
--
http://mail.python.org/mailman/listinfo/python-list
I'd like to be able to save a Tkinter Canvas in a format other than
postscript (preferably gif). Is there a tool out there for
accomplishing that? Any help will be much appreciated.
Peace,
STM
--
http://mail.python.org/mailman/listinfo/python-list
def PRINT(x): print x
f = lambda: PRINT("hello")
###
def let(x,y):
globals()[x] = y
return True
f = lambda x: let('y',x*x) and y+y
--
http://mail.python.org/mailman/listinfo/python-list
Tom Anderson wrote:
> So, if you're a pythonista who loves map and lambda, and disagrees with
> Guido, what's your background? Functional or not?
glad you asked. personally i don't know lisp (or scheme), but now i've
decided to learn it, because eventually it will no longer be possible
in python
Peter Hansen wrote:
> Sean, what gave you the impression this would change?
just inductive reasoning. i've been wrong before (like anyone who makes
that claim), and i'm a former python enthusiast, so my judgement must
be colored to some extent by bitterness. maybe they have solid reasons
for scr
And now for a pair of questions that are completely different:
1) I'd like to be able to bind callbacks to presses of the arrow
buttons on the keyboard. How do you say that in Tkinter?
2) The function 'listdir' in os.path returns a list of all the files
in the given directory - how do I get hold
s, without success. Any assistance would be greatly
appreciated.
Peace,
Sean McIlroy
--
http://mail.python.org/mailman/listinfo/python-list
I can't claim to have studied your problem in detail, but I get
reasonable results from the following:
filename = 'Errors.txt'
S = open(filename,'r').read().split()
f = lambda x: (x[0]=='@' and x[6:] + '.0') or (x=='/' and x + '\n') or
x
open(filename,'w').write(' '.join(map(f,S)))
HTH
-
Hi all!
I've written a utility for making diagrams. It could also be a good
environment for experimenting with a Tk canvas, so I'm including the
code here (see below). The problem is that, when I save a canvas and
include the resulting postscript file in a LaTeX document, I often
find that the rig
Alright, now it's too much. It's not enough that you're eliminating it
from the language, you have to stigmatize the lambda as well. You
should take some time to reflect that not everybody thinks the same
way. Those of us who are mathematically inclined like the lambda
because it fits in well with
'scale' puts the lower-right corner of a bounding box where the
pointer is, while keeping the upper-left corner where it was before
(or, if the relevant item's coordinates aren't of bounding-box type,
the function does nothing).
Thanks for the link.
Peace,
STM
"[EMAIL PROTECTED]" <[EMAIL PROTEC
I'm looking for a widget, to be used with Tkinter, that displays a
tree whose leaves are strings. I thought there was something like that
in the Python Megawidgets, but when I look at the documentation
(http://pmw.sourceforge.net/doc/refindex.html), it doesn't seem to be
there. Any advice will be m
I'm dealing with XML files in which there are lots of tags of the
following form: xy (all of these letters are being
used as 'metalinguistic variables') Not all of the tags in the file are
of that form, but that's the only type of tag I'm interested in. (For
the insatiably curious, I'm talking abo
Exactly what I was looking for. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
The 'Canvas Methods' section of the online Intro to Tkinter
(http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm)
refers (without explanation) to something called "bbox". What is this?
TIA
--
http://mail.python.org/mailman/listinfo/python-list
>>> mean = lambda x: sum(x)/len(x)
>>> median = lambda x: (max(x)-min(x))/2
>>> mode = lambda x: max([(x.count(y),y) for y in x])[1]
"Robert Brewer" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> (now that we have a meaningful subject line)
>
> Alfred Canoy wrote:
> > >> I'm
There's something quite simple I'd like to do, but I'm hampered by
lack of knowledge regarding Tkinter. If someone could help me out with
a snippet of maximally-simple code showing, in general terms, how to
do this, that would be really great. What I want to do is simply to
move a shape around on t
I've got a bunch of Frames, all packed into the root window with
side=TOP, and in each Frame I've got a Checkbutton packed with
side=LEFT. I expected the Checkbuttons to be flush with the left edge
of the window, but they're not, and it looks a little gross. How do I
get them to align?
--
http://m
Can anybody help me make sense of the fact that the following script
doesn't work? It's so simple I can't imagine what I'm missing. Any
help will be much appreciated.
Peace,
STM
## ALARM CLOCK:
from time import sleep,time,localtime
wakeuptime = input('hours: '), input('minutes: ')
onehourlater
ACHES THIS POINT
##
Peter Hansen <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Sean McIlroy wrote:
> > Can anybody help me make sense of the fact that the following script
> > doesn't work? It's so simple I can't imagi
Heiko Wundram <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Why not try the following:
I did try it, and it didn't work either. It appears there must be
something wrong with my computer, hopefully something benign. Thanks
anyway.
Peace,
STM
--
http://mail.python.org/mailm
This needs some background so bear with me.
The problem: Suppose p is a permutation on {0...n} and t is the
transposition that switches x and y [x,y in {0...n}]. A "stepup pair"
(just a term I invented) for p is a pair (a,b) of integers in {0...n}
with a>
k = 18
moved = [i for i in range(l
"Jordan Rastrick" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL
PROTECTED]>...
Wow. I'd resigned myself to the task of reformulating my question in
an intelligent way, I stopped by just to leave a little note to the
effect that the thread wasn't dead, and I find out the question's been
answ
Wow again. I had a real "V8 moment" when I looked at your solution
(smacking my forhead, groaning ruefully, etc). You were right: my
intention was simply to hide the trivial cases from view; I completely
missed the fact that I was now testing for membership in a different
set. I should have rememb
hello
(how) can you change the text of a Tkinter Button by clicking it?
something like
def click(index): return lambda: buttons[index].text = 'hello'
buttons = [Button(root,command=click(index)) for index in
range(numbuttons)]
only with an attribute that Buttons actually have. sorry to have to
a
never mind. i found it.
--
http://mail.python.org/mailman/listinfo/python-list
## term rewriter (python 3.1.1)
def gettokens(string):
spaced = string.replace('(',' ( ').replace(')',' ) ')
return spaced.split()
def getterm(tokens):
if tokens[0] in '()':
term = []
assert tokens[0] == '('
tokens.pop(0)
while not tokens[0] == ')': te
well, somebody's already pointed out that bool(msg)==False iff msg==''.
i'm curious to know what's wrong with simply writing
if msg=='':
## do_something
--
http://mail.python.org/mailman/listinfo/python-list
hi all
when i run this code in python 2.3
## BEGIN CODE
class warfare:
def __init__(self): self.pairs = [[0,0]]*2
def __str__(self): return str(self.pairs)
def setfirst (self,i,value): self.pairs[i][0] = value
def setsecond(self,i,value): self.pairs[i][1] = va
thanks
--
http://mail.python.org/mailman/listinfo/python-list
hi all
is there a way to do this ...
class clown:
def __init__(self):
self.x = 0
self.y = ALIAS(self.x) ## FEASIBLE ?
... so that you get results like this ...
krusty = clown()
krusty.x
>> 0
krusty.y
>> 0
krusty.x = 1
krusty.x
>> 1
krusty.y
>> 1
... ? th
On Feb 17, 9:59 pm, "Deron Meranda" <[EMAIL PROTECTED]> wrote:
[snip]
this may be really dense, but i'm curious what's wrong with the
"multiplexer" idiom:
for item in some_sequence:
item2 = (not some_rare_condition and item) or \
(some_rare_condition and
some_transform_fun
"""
AUTHOR: Sean McIlroy
LANGUAGE: Python 2.5
OVERVIEW: instances of "tictactoeplayer" play optimal tictactoe
SPECIALIZED TYPES: player={ex,oh}; empty={blank}; cell=player+empty;
board=[cell]
TYPE RELATIONS: bool(c)==True for any c in cell
"""
ex, oh
hola
i'd like to control another interpreter from idle. i don't have any
experience using unix but i think a "pipe" is what i need. am i right
about this? can anybody point me to a simple example of using a pipe
(if that's the right thing) for this kind of task? thanks if you can
help.
peace
stm
hi all
i'd like to write a module that, when run in the interpreter, would
cause the interpreter to read certain strings that would normally be
rejected as syntax errors (strings beginning with the @ symbol, say)
and pass them on to an object defined in the aforementioned module.
where should i lo
never mind. i found it.
--
http://mail.python.org/mailman/listinfo/python-list
hello
how do i say "chr" and "ord" in the new python? the functions below
(which work in 2.6.6) show what i'm trying to do. thanks if you can
help.
def readbytes(filepath):
return [ord(x) for x in open(filepath,'rb').read()]
def writebytes(numbers,filepath):
open(filepath,'wb').write(''.
thanks. that did the trick. in case anyone else is in the same boat as
myself, here are the relevant correspondences:
string <-> [int] bytes <-> [int]
---
--
lambda string: [ord(x) for x in string] list
lambda ints: ''.join([chr(x
"""
A Sequence is a list [FormatType, TimeDivision, Tracks] where
*) FormatType is in [0,1,2]
*) TimeDivision is either [TicksPerBeat] with TicksPerBeat in range
(2**15) or
[FramesPerSecond, TicksPerFrame] with FramesPerSecond in range
(2**7)
and TicksPerFrame in range(2**8)
*) Tracks is a
i think what he means is to put the global declaration inside the
function that assigns to filename:
def open_file_dialog():
global filename
filename = tkFileDialog.askopenfilename(filetypes=
[("allfiles","*")])
as it was, the function was creating a new variable called filename
and assi
## python 2.6.2
from tkFileDialog import askopenfilename, askdirectory
def nowindow(function):
def windowless():
from Tkinter import Tk
Tk().withdraw()
return function()
return windowless
getfilename = nowindow(askopenfilename)
getdirectoryname = nowindow(askdirec
46 matches
Mail list logo