On Fri, Mar 29, 2013 at 8:00 PM, Clyde Wilson wrote:
>
> from tkinter import *
> root=Tk()
> main=Frame(root)
> main.grid()
> def doit():
> messagebox.showinfo("Hello")
You have to import the module first:
from tkinter import messagebox
http://hg.python.org/cpython/file/bd8afb90ebf2/Lib
The following code works fine under IDLE but errors when run as a standalone:
from tkinter import *
root=Tk()
main=Frame(root)
main.grid()
def doit():
messagebox.showinfo("Hello")
btn1=Button(main,width=10,text="In")
btn1.grid()
lbl1=Label(main)
lbl1.grid()
btn2=Button(main,width=10,text="Out
On 29/03/13 12:34, Alan Gauld wrote:
A slight tweak to the solution; you probably need:
So in pseudo code you should have
while True:
read input
if exit condition break
try:
convert to int
break
except ValueError: continue
process the value
HTH
--
Alan G
On 03/29/2013 07:33 AM, Ghadir Ghasemi wrote:
Hi guys I am trying to create part of a vending machine. The section below is if the user wants to
insert 50p coins. It works but when I entered a non integer like
'dfsdf', the program just broke. Is there a way that the program can
check if the in
On 29/03/2013 11:33, Ghadir Ghasemi wrote:
Hi guys I am trying to create part of a vending machine. The section below is
if the user wants to insert 50p coins. It works but when I entered a non
integer like 'dfsdf', the program just broke. Is there a way that the program
can check if the input
On 29/03/2013 12:21, Shall, Sydney wrote:
or;
where x is the input == fiftypencecoins;
return isinstance(x, int)
will return True or False
Then you can proceed as you wish.
If you enter invalid input you'll never get x to be an int so how can
you test it with isinstance?
--
If you're usin
On 29/03/2013 11:39, Amit Saha wrote:
On Fri, Mar 29, 2013 at 9:35 PM, Amit Saha wrote:
On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi
wrote:
Hi guys I am trying to create part of a vending machine. The section below is
if the user wants to insert 50p coins. It works but when I entered a no
On 29/03/13 11:33, Ghadir Ghasemi wrote:
Hi guys I am trying to create part of a vending machine.
when I entered a non integer like 'dfsdf', the program just broke.
> Is there a way that the program can check if the input is an integer,
Yes you can use try/except to catch the failure.
if i
On Fri, Mar 29, 2013 at 9:35 PM, Amit Saha wrote:
> On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi
> wrote:
>> Hi guys I am trying to create part of a vending machine. The section below
>> is if the user wants to insert 50p coins. It works but when I entered a non
>> integer like 'dfsdf', the
On Fri, Mar 29, 2013 at 9:39 PM, Amit Saha wrote:
> On Fri, Mar 29, 2013 at 9:35 PM, Amit Saha wrote:
>> On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi
>> wrote:
>>> Hi guys I am trying to create part of a vending machine. The section below
>>> is if the user wants to insert 50p coins. It work
On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi
wrote:
> Hi guys I am trying to create part of a vending machine. The section below is
> if the user wants to insert 50p coins. It works but when I entered a non
> integer like 'dfsdf', the program just broke. Is there a way that the program
> can
Hi guys I am trying to create part of a vending machine. The section below is
if the user wants to insert 50p coins. It works but when I entered a non
integer like 'dfsdf', the program just broke. Is there a way that the program
can check if the input is an integer, and if it is, then the progra
12 matches
Mail list logo