Is PyFIT dead and abandoned?

2008-10-06 Thread oakley
I was wanting to experiment with PyFIT but it seems DOA. Googling
doesn't yield any information less than two years old. When I try to
install 0.8a2 I get errors because setup.py references a non-existant
file (FitFilter.py). I find it hard to believe that in two years
nobody has stumbled over this unless there's simply no one using it.

Has PyFIT been completely abandoned? Is there a better alternative or
other resources to help me integrate fitnesse and python?

--
http://mail.python.org/mailman/listinfo/python-list


Re: regular expression - matches

2006-07-21 Thread James Oakley
On Friday 21 July 2006 10:57 am, abcd wrote:
> yea i saw thatguess I was trusting that my regex was accurate :)
> ...b/c i was getting a Matcher when I shouldnt have, but i found that
> it must be the regex.

http://kodos.sourceforge.net/

Makes regex generation and debugging much easier.

-- 
James Oakley
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need Python for Linux (Suse 10.1)

2006-08-31 Thread James Oakley
On Thursday 31 August 2006 6:16 am, Dick Moores wrote:
>  I've got a friend interested in trying out Python. I sent him to 
> http://www.python.org/download/linux/ but he's uncertain as to what to
> download. He's rather get a new download than use what was on his Suse
> disk. His box is an x86.
>
>  Any chance Python 2.4.3 compressed source tarball would be suitable for
> him?

He already has it. Python is installed by default on most Linux distributions, 
including SUSE.

If he wants Python IDEs, libraries, and tools, he should open up YaST, 
select "Software Management", select the search filter, and enter python in 
the search box.

There's a ton of Python stuff on SUSE, and there's even more in my 
YaST-compatible repo at http://repos.opensuse.org/home:/jimfunk/ .

-- 
James Oakley
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter, overwrite Label-text?

2008-04-11 Thread Bryan Oakley
[EMAIL PROTECTED] wrote:
> ok but i have trouble using grid. if i try to use a Label witht he
> text answer in the following code it doenst work very well.
> 

Can you describe "have trouble"? What sort of trouble -- syntax errors, 
the text never shows up, etc?

Following is my attempt to use a label and textvariables for both the 
label widget and the entry widget. Caveat emptor: I've *never* written a 
tkinter program before in my life. I'm a tcl/tk expert but I'm learning 
python and this is my very first attempt.

I took the liberty to reorganize the code slightly. There are still 
resize behaviors I don't like but let's tackle one problem at a time 
(rest assured: the problems are all solvable).

Does this do what you want?

from __future__ import division
import Tkinter
from Tkinter import *

def main():
 root = Tkinter.Tk()
 makeUI(root)
 root.mainloop()
 exit()

def makeUI(root):
 global entryVariable
 global displayVariable

 displayVariable = StringVar()
 entryVariable = StringVar()

 root.title("Calculator")
 entry = Entry(root, textvariable=entryVariable)
 entry.grid(row=1, column=1, columnspan=4, sticky="nsew")

 display=Label(root, textvariable=displayVariable)
 display.grid(row=2, column=1, columnspan=4, stick="nsew")

 x = 1
 y = 4
 for char in '123+456-789*0()/.':
 b = Button(root, text=char, command=lambda n=char:Disp(n),
width=2, height=1)
 b.grid(row=y, column=x)
 x=x+1
 if x==5:
 x=1
 y=y+1

 b = Button(root, text="^", command=lambda n="**":Disp(n),
width=2,height=1)
 b.grid(row=8, column=2)
 b = Button(root, text="C",command=Erase, width=2, height=1)
 b.grid(row=8, column=3)
 b = Button(root, text="c",command=Backspace, width=2, height=1)
 b.grid(row=8, column=4)
 b = Button(root, text="=",command=Calc, width=18, height=1)
 b.grid(row=9, column=1, columnspan=8)

def Disp(nstr):
 global entryVariable
 tmp=entryVariable.get()
 tmp+=nstr
 entryVariable.set(tmp)

def Calc():
 global entryVariable
 global displayVariable

 expr=entryVariable.get()
 displayVariable.set("")
 try:
 displayVariable.set(eval(expr))
 except:
 displayVariable.set("Not computable")

def Erase():
 global entryVariable
 global displayVariable

 entryVariable.set("")
 displayVariable.set("")

def Backspace():
 global entryVariable
 tmp=entryVariable.get()
 tmp=tmp[0:-1]
 entryVariable.set(tmp)

main()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter, annoying grid-problem

2008-04-13 Thread Bryan Oakley
[EMAIL PROTECTED] wrote:
> so my little calculator works perfectly now. just having some trouble
> with the layout.
> this whole tkinter-thing seems to be more tricky than it should be.
> how can i make the 4 column of buttons have the same distance and
> size  between them as the other 3 columns?
> and how can i make the top entry end where the 2nd row entry
> ends(meaning the top entry will be longer)?
> 
> why are the 4th row split from the others? hard to fix the problems
> when u dont even understand why things happen. seems so llogical a lot
> of it. i change something then something unexpected happens.

The best answer I can give (being a Tk expert but not yet a tkinter 
expert) is to start with a piece of graph paper. Draw the GUI out and 
you'll probably see what the problems are. For one, the second entry 
(for the answer) spans 4 columns and begins at column 3, so it ends up 
in column 6. This ends up affecting the whole layout because nothing 
else goes to column six.

You'll probably find it much easier going to break down your GUI into 
sections. One for the calculator buttons and one for everything else. 
Create a frame for the buttons and it becomes trivial to layout out all 
the buttons in a 4x6 grid, unaffected by things outside that grid. Then, 
create your other widgets and grid the whole frame of buttons as a 
single unit inside the outermost frame. I quite often use grid for 
interior groupings, then use pack on the outter-most frame to manager 
the various groups.

Using the grid layout manager is trivial if you do a little thinking and 
planning up front. If you don't, you can spend all day chasing down why 
you end up with an extra blank row or column, unusually sized rows and 
columns, etc. Again, get a piece of graph paper and draw it out -- that 
helps immensely when you're first coming up to speed using grid.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a way to include Pyhtho scripting INSIDE a python program

2008-04-13 Thread Bryan Oakley
Ivan Illarionov wrote:

> You don't need to envoke another interpreter.
> Python can interpret arbitrary python code with exec statement.
> Wrap user's string inside function definition, and exec it.
> 
> You might want to disable words like `import`, `exec` and `eval` in
> user's code because it's a big security risk.

The above statement is exactly why one would want to eval the code 
inside a separate interpreter. Not just for security, but to prevent 
user code from stomping all over the application code by creating or 
destroying global resources.

Is it possible to create a nested interpreter like you can do in some 
other languages?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter, canvas, get color of image?

2008-04-13 Thread Bryan Oakley
[EMAIL PROTECTED] wrote:
> mapq = PhotoImage(file = 'C:\Users\saftarn\Desktop\elmapovic.gif')
> w.create_image(10, 10, image = mapq, anchor = NW)
> 
> after doing this is there any possibility of getting the
> characteristics of the GIF-picture(or bitmap if i use that)?
> 
> it would be very helpfull if i for example could do something like
> canvas.getcolor(image, mouseclick.x,mouseclick.y) if u get the point.
> get the color of the image where i clicked.

The image isn't "painted" on the canvas, so to answer your specific 
question, no, you can't get the color of a pixel on the canvas in the 
way that you ask.

However, when you click on the canvas you can get the item that was 
clicked on and the x/y of the click. From that you can figure out which 
pixel of the image is under the cursor. And from that you can query the 
image for the color of a specific pixel.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter, canvas, get color of image?

2008-04-15 Thread Bryan Oakley
[EMAIL PROTECTED] wrote:
> On 13 Apr, 19:19, Bryan Oakley <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>>> mapq = PhotoImage(file = 'C:\Users\saftarn\Desktop\elmapovic.gif')
>>> w.create_image(10, 10, image = mapq, anchor = NW)
>>> after doing this is there any possibility of getting the
>>> characteristics of the GIF-picture(or bitmap if i use that)?
>>> it would be very helpfull if i for example could do something like
>>> canvas.getcolor(image, mouseclick.x,mouseclick.y) if u get the point.
>>> get the color of the image where i clicked.
>> The image isn't "painted" on the canvas, so to answer your specific
>> question, no, you can't get the color of a pixel on the canvas in the
>> way that you ask.
>>
>> However, when you click on the canvas you can get the item that was
>> clicked on and the x/y of the click. From that you can figure out which
>> pixel of the image is under the cursor. And from that you can query the
>> image for the color of a specific pixel.
> 
> 
> how do i get the item?
> http://effbot.org/tkinterbook/canvas.htm#Tkinter.Canvas.create_image-method
> 
> with any of those methods?
> 
> when i click the mouse i can get event.object u mean?

You can use find_closest to find the object closest to the x,y of the 
event. You can also do find_withtag(tk.CURRENT) which returns the item 
under the mouse pointer.
-- 
http://mail.python.org/mailman/listinfo/python-list