FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 07-27-2012, 10:50 AM
Roger
 
Default OT: need python help please

My daughter wants to teach her students tkinter interface with python.

She cannot get an entry into the field entry1=Entry(fishDisplay,
width=35).grid(row=0, column=1)
to display and this is out of my expertise. Can someone point us to a
suitable tutorial on how to get test in a tk field into a variable and
how to display it.


I ran Idle debug and the result from entry1 is None.

Part of the little app she wrote is as follows.
Please help if possible.
thanks in advance
Roger

from fish import *
from tkinter import *

def searchFish():

def fishies(*args):
#names
siamon = fish[0][0]
goldfish = fish[1][0]
norbert = fish[2][0]
slug = fish[3][0]
snail = fish[4][0]
howzart = fish[5][0]
fidget = fish[6][0]
#aggressive
siamon_a = fish[0][1]
goldfish_a = fish[1][1]
norbert_a = fish[2][1]
slug_a = fish[3][1]
snail_a = fish[4][1]
howzart_a = fish[5][1]
fidget_a = fish[6][1]
#habit
siamon_h = fish[0][2]
goldfish_h = fish[1][2]
norbert_h = fish[2][2]
slug_h = fish[3][2]
snail_h = fish[4][2]
howzart_h = fish[5][2]
fidget_h = fish[6][2]

if entry1=="Goldfish":
details=Label(fishDisplay, bg='lightblue',
text='Goldfish').grid(row=3, column=1)




#print(goldfish[0], goldfish_a[0],goldfish_h[0]) #use the [0] to
remove the [']'s when printed

#### THE START OF THE TKINTERFACE ####

# sf = searchFish
sf = Tk()
sf.title('Jackson's Pond Emporium >> Search A Fish')
sf.geometry("500x400")
sf['background']='lightblue'

window=Frame(sf).pack()

green = PhotoImage(file='GreenFish.gif', master=sf)

topFrame = Frame(window, bg='lightblue').pack(side=TOP, anchor=NW)
newfont = ('arial', 20, 'bold')
g = Label(topFrame, image=green, bg='lightblue').pack(side=LEFT,
anchor=NW, padx=2, pady=2)
title = Label(topFrame, text = 'Fishbase', font = newfont,
bg='lightblue')

title.config(height=3, width=3)
title.pack(side=TOP, fill=BOTH)

fishDisplay = Canvas(window, bg='lightblue')

Label(fishDisplay, text='Keyword:', bg='lightblue',
fg='black').grid(row=0, column=0, sticky=W)

entry1=Entry(fishDisplay, width=35).grid(row=0, column=1)
btn_search=Button(fishDisplay, width=6, text='Search',
command=fishies).grid(row=0, column=3)


Label(fishDisplay, text='Details:', bg='lightblue',
fg='black').grid(row=2, column=0, sticky=W)
details=Label(fishDisplay, bg='lightblue', text='Search the
Fishbase').grid(row=2, column=1)

fishDisplay.pack(side=TOP, anchor=W, fill=X)

sf.bind('<Return>', fishies)
print('entry1 ',entry1)
sf.mainloop()

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
 
Old 07-28-2012, 12:39 AM
Michael Hennebry
 
Default OT: need python help please

On Fri, 27 Jul 2012, Roger wrote:


My daughter wants to teach her students tkinter interface with python.

She cannot get an entry into the field entry1=Entry(fishDisplay,
width=35).grid(row=0, column=1)
to display and this is out of my expertise. Can someone point us to a
suitable tutorial on how to get test in a tk field into a variable and
how to display it.


I ran Idle debug and the result from entry1 is None.


Entry(...) probably returns what is wanted.
The method grid might return None by design.
I don't see any examples where the return value is used:
http://effbot.org/tkinterbook/grid.htm

--
Michael hennebry@web.cs.ndsu.NoDak.edu
"On Monday, I'm gonna have to tell my kindergarten class,
whom I teach not to run with scissors,
that my fiance ran me through with a broadsword." -- Lily
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
 

Thread Tools




All times are GMT. The time now is 10:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org