which is the easiest module to use to just get started with webapps
quicklya nd starting getting things up and running, not advanced stuff
just basic.
--
http://mail.python.org/mailman/listinfo/python-list
so i load a gif onto a canvas and when i click the canvs i want to get
the color of the pixel that is clicked.
so i need to ge the object im clicking.
i was told in another thread to use find_withtag or find_closest but
it is not working, maybe im using the
method on the wrong object.
how do i do t
On 16 Apr, 00:46, Bryan Oakley <[EMAIL PROTECTED]> wrote:
> [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
actually that 0**0 statement was wrong. 0**0 = 1 and should be.
--
http://mail.python.org/mailman/listinfo/python-list
how do i solve power(5,1.3)?
def power(nbr, po):
if po==0:
return 1
if po>0:
return nbr*power(nbr, po-1)
if po<0:
return 1/power(nbr, -1*po)
also i found a link which states 0^0 isnt 1 even though every
calculator ive tried says it is.
it doesnt say what it is
the 0.409 vs 0.095 is the total times right?
so the imperative function is >4 times faster than the recursive.
or what does tottime stand for?
is this always the case that the recursive function is slower?
the gain is less code?
are some functions only implementable recursively?
def power(nbr,
i use this code to profile. however for small standard functions it
just says 0 seconds.
so one solution is to run the function a very big number of times(how
big?).
but the bottom code doesnt work, it just runs the same profiling 1
times insetad of running the fucntion 10K
times and evaluate t
On 14 Apr, 14:11, John Machin <[EMAIL PROTECTED]> wrote:
> On Apr 14, 7:24 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > > Is it a console program or a gui program?
> > GUI
> > > What happens when you run it without py2exe?
>
> > it works perfectly, both from within python and launching from
> > "windows"
On 16 Apr, 00:24, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Tue, 15 Apr 2008 17:45:08 -0300, <[EMAIL PROTECTED]> escribió:
>
> > when calling function hmm here, what do i get? the widget i clicked
> > on?
> > if i have a canvs on wich i have a bitmap and i click on the bitmap,
> > is the
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("", key)
w.bind("", hmm)
d
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
On 14 Apr, 09:13, v4vijayakumar <[EMAIL PROTECTED]>
wrote:
> In computer based, two player, board games, how to make computer play?
> Are there any formal ways to _teach_ computer, to choose best possible
> move?
>
> I know this is kind of off-topic here. Please redirect me, if there
> are more app
> Is it a console program or a gui program?
GUI
> What happens when you run it without py2exe?
it works perfectly, both from within python and launching from
"windows"
> Have you searched for "has stopped working" in
(a) your source code
yes no such message there
> (b) the py2exe source code?
no,
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
why is the first program not working? when i click the screen the map
is not appearing.
the second program works.
from Tkinter import *
master = Tk()
w = Canvas(master, width=700, height=600)
w.pack(expand = YES, fill = BOTH)
def mapper():
mapq = PhotoImage(file = 'C:\Users\saftarn\Deskt
so i used py2exe and i have the build and the dist-folders.
in the distfolder there is a Calculator.exe file.
when i run it it just says "Calculator.exe has stopped working" in a
popup but the program itself never shows up.
wtf!?
and when im distributing my program i have to include both catal
windows vista and python 2.5, is there a way to get the latest command
entered? would be very useful.
if not by default, anything i could download or write myself?
--
http://mail.python.org/mailman/listinfo/python-list
windows vista and python 2.5, is there a way to get the latest command
entered? would be very useful.
if not by default, anything i could download or write myself?
--
http://mail.python.org/mailman/listinfo/python-list
solved this:
def Backspace():
st = e.index(INSERT)
e.delete(st-1,st)
--
http://mail.python.org/mailman/listinfo/python-list
in this program when using the "c"-button it deletes the last token
entered. i want to delete the token after the mousecursor.
lets say the string is: 12*(81**.5+12) and i put the cursor between
the * and * because i want times .5 not root.
now if i press "c" it deletes ")" which is not what i wan
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 en
how do i profile a program? i found out that there are some profilers
included in the standard library but couldnt really figure out how to
access/use them
--
http://mail.python.org/mailman/listinfo/python-list
On 10 Apr, 18:03, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Thu, 10 Apr 2008 07:37:08 -0700, skanemupp wrote:
> > i know how to do this already. the problem is i want the text to stay
> > in the windowa nd not start overwriting "Answer:".
>
here i didi it with pack() but when i try to use the answerwidget it
gtes all f* up. any suggestions?
from __future__ import division
import Tkinter
from Tkinter import *
mygui = Tkinter.Tk()
mygui.title("Calculator")
##l = Label(mygui, text="Answer: ")
##l.grid(row=2, column=1, columnspan
the code is down below. when i click maximize window it looks terrible
since the widgets are not keeping their relative size.
i guess i could use pack or grid to do that instead of place?
but i tried with pack and grid before and had trouble making it
looking good.
is it possible to have the minim
in this function i want to be able to use the cursor and delete in the
middle of a number.
how do i get the value of anchor or insert?
i want to write:
e.delete(pos-1,pos)
def Backspace():
a=len(e.get())
e.delete(a-1,END)
#e.delete(INSERT, END)
#e.delete(ANCHOR,END)
the complete p
On 10 Apr, 16:29, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Apr 10, 3:47 pm, [EMAIL PROTECTED] wrote:
>
> > [...]
> > i use the Label-widget.
>
> Then you should be able to connect a variable to your widget like I
> wrote in my previous post.
> Just try out the example from the Python doc
On 10 Apr, 15:28, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Apr 10, 2:35 pm, [EMAIL PROTECTED] wrote:
>
> > using python And tkinter.
>
> > i have a GUI that outputs a text among other things. after input form
> > user i want this text to be *)cleared and/or
> > *)overwritten.
>
> > what
On 10 Apr, 12:38, [EMAIL PROTECTED] wrote:
> > def Calc():
> > global nbr
> > try:
> > print eval(nbr)
> > #a = Label(mygui, text=eval(nbr))
> > #a.place(relx=0.4, rely=0.1, anchor=CENTER)
> > except:
> > print "Not computable"
> > nbr = ""
>
> > def
using python And tkinter.
i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.
what is the best way to achieve that?
also, how do i make Label-text expand to the right and not to the left?
--
http://mail.python.org/mai
from __future__ import division
import Tkinter
from Tkinter import *
mygui = Tkinter.Tk()
mygui.title("Calculator")
l = Label(mygui, text="Answer: ")
l.place(relx=0.15, rely=0.2, anchor=CENTER)
e = Entry(mygui)
e.place(relx=0.4, rely=0.1, anchor=CENTER)
def Disp(nstr):
e.insert(END, nstr)
On 10 Apr, 13:15, [EMAIL PROTECTED] wrote:
> > the erase() id alwys need if u wanna abort whilst u wrote something.
>
> But if it is meant to only evaluate once you've pressed the enter key
> (I take it?) you shouldn't need that. And if you are to abort while
> evaluating it will not do that.
CHA
On 10 Apr, 12:38, [EMAIL PROTECTED] wrote:
> > def Calc():
> > global nbr
> > try:
> > print eval(nbr)
> > #a = Label(mygui, text=eval(nbr))
> > #a.place(relx=0.4, rely=0.1, anchor=CENTER)
> > except:
> > print "Not computable"
> > nbr = ""
>
> > def
here is the whole code:
from __future__ import division
import Tkinter
from Tkinter import *
mygui = Tkinter.Tk()
mygui.title("Calculator")
w = Label(mygui, text="Answer: ")
w.place(relx=0.15, rely=0.1, anchor=CENTER)
nbr = ""
def Disp(nstr):
global nbr
nbr=nbr+nstr
print "You need
On 10 Apr, 10:51, [EMAIL PROTECTED] wrote:
> In general you should only catch the exceptions you want to catch,
> therefore avoiding the issue of catching "unexpected" ones, for
> instances the programming unexpectandly closing.
>
> Well, exception handling is expensive (when it catches one) so it
is there a general philosophy as to when to use exceptions and when
not to?
like here:
def Calc():
global nbr
try:
print eval(nbr)
except:
print "Not computable"
nbr = ""
i have a calculator and nbr is a string that contains '0123456789+-*/'
if the string ends on
should i not use self. in Clean() and Calculate() either?
anyway i had changed it before. must have copied the wrong program.
#! /usr/bin/env python
from Tkinter import *
import tkMessageBox
class GUIFramework(Frame):
"""This is the GUI"""
def __init__(self, master=None):
"""I
On 6 Apr, 22:15, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Sun, 06 Apr 2008 15:12:55 -0300, <[EMAIL PROTECTED]> escribió:
>
> I can't help with your sizing problem, I don't know grids. But don't do
> this:
>
> > def Display(self, number):
> > self.expr = self.expr + number
> >
On 6 Apr, 22:50, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > how do you create exe-files of your python-code?
>
> > is it different depending on what libraries, GUI-frameworks you use?
>
> > i want to create an exe-file of a pythonscript that uses Tkinter.
>
> assuming w
how do you create exe-files of your python-code?
is it different depending on what libraries, GUI-frameworks you use?
i want to create an exe-file of a pythonscript that uses Tkinter.
--
http://mail.python.org/mailman/listinfo/python-list
is there anyway to make this shorter? i hate having these big blocks
of similar-looking code, very unaesthetic.
maybe doesnt matter good-code-wise?
anyway can i make some function that makes this shorter?
like put the etiquettes on the button froma string of
'123+456-789*0Cr/' ?
problem is the comm
when i added the results-LABEL the buttons have changed place.
meh why cant i just put buttons and stuff on a specific coordinate and
have them staying there?
#! /usr/bin/env python
from Tkinter import *
import tkMessageBox
class GUIFramework(Frame):
"""This is the GUI"""
def __init__
so my calculator is almost done for u that have read my previous
posts.
i have some minor problems i have to fix though.
*one is i need to repaint once i have performed a calculation so that
the old results are not left on the screen.
cant find a method for that.
*another is now when i write the
it seems to me from my results that when i use a while-loop it will
execute once after the condition is met.
ie the conditions is met the code executes one time more and then
quits.
--
http://mail.python.org/mailman/listinfo/python-list
which is the best way to check if a string is an number or a char?
could the 2nd example be very expensive timewise if i have to check a
lot of strings?
this
value = raw_input()
try:
value = int(value)
except ValueError:
print "value is not an integer"
or:
c=raw_input("yo: ")
if c in
> Just like the message says: You are trying to use `str` (on the right hand
> side of the assignment) before anything is bound to that name.
>
> Ciao,
> Marc 'BlackJack' Rintsch
i know but i want the variable str(which i found out is a reserved
word so i changed it) to be accessible all
> input = "hello"
> input += " world"
> print input
this i know. im wondering how to handle the variable in the actual
program. this exception i get:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
return self
using tkinter and python i now have a small App (that will hopefully
soon be a fully functioning calculator) where u can push buttons and
the corresponding number or operator is shown.
when u press 1, "1" appears on the screen, pres + and "+" appears etc.
at the moment every output overwrites the
it works now. here is all the code:
#! /usr/bin/env python
from Tkinter import *
import tkMessageBox
class GUIFramework(Frame):
"""This is the GUI"""
def __init__(self, master=None):
"""Initialize yourself"""
"""Initialise the base class"""
Frame.__init__(self,ma
how do i do that? i get this error:
self.btnDisplay = Button(self,text='1',command=lambda
n=1:self.Display(n))
self.btnDisplay.grid(row=3, column=0, padx=5, pady=5, width=1)
self.btnDisplay = Button(self,text='/',command=lambda
n="/":self.Display(n))
self.btnDisplay.grid(
on windows vista these buttons dont have the same size, the "/"
shrinks a little. how do i make them the same size or prevent
shrinking?
a mac-user told me they look the same to him so maybe it doesnt shrink
on macs but it does when using VISTA.
i tried some .propagate and extend-stuff but didnt w
On 5 Apr, 17:09, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> >> def __init__(self):
> >> # ...
> >> button = Button(self,
> >> text='1',
> >> command=lambda n=1: self.display(n))
> >> # ...
>
> >>
>
> def __init__(self):
> # ...
> button = Button(self,
> text='1',
> command=lambda n=1: self.display(n))
> # ...
>
> def display(self, number):
> print number
>
should this really be inside the __init__ fun
am i not doing that then? did u look at the code? where do i add the
bind if this:
btnDisplay = Button(self, text="1", command=self.Display)
btnDisplay.grid(row=3, column=0, padx=5, pady=5)
is not enough?
def Display(self, event_obj):
button = event_obj.widget
text = but
On 5 Apr, 07:02, [EMAIL PROTECTED] wrote:
> On 5 Apr, 05:57, [EMAIL PROTECTED] wrote:
>
>
>
> > On 5 Apr, 05:26, 7stud <[EMAIL PROTECTED]> wrote:
>
> > > On Apr 4, 7:06 pm, [EMAIL PROTECTED] wrote:
>
> > > > 1st question:
>
> > > > when i run this program 1 will be printed into the interpreter when
On 5 Apr, 05:57, [EMAIL PROTECTED] wrote:
> On 5 Apr, 05:26, 7stud <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Apr 4, 7:06 pm, [EMAIL PROTECTED] wrote:
>
> > > 1st question:
>
> > > when i run this program 1 will be printed into the interpreter when i
> > > run it BUT without me clicking the actual but
On 5 Apr, 05:26, 7stud <[EMAIL PROTECTED]> wrote:
> On Apr 4, 7:06 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > 1st question:
>
> > when i run this program 1 will be printed into the interpreter when i
> > run it BUT without me clicking the actual button.
> > when i then click the button "1", nothing hap
1st question:
when i run this program 1 will be printed into the interpreter when i
run it BUT without me clicking the actual button.
when i then click the button "1", nothing happens.
obv i dont want any output when i dont push the button but i want it
when i do.
what am i doing wrong here?
58 matches
Mail list logo