Python GUI questions
maiden129
sengokubasarafever at gmail.com
Tue Mar 19 21:25:56 EDT 2013
On Tuesday, March 19, 2013 8:57:42 PM UTC-4, Rick Johnson wrote:
> On Tuesday, March 19, 2013 2:01:24 PM UTC-5, maiden129 wrote:
>
> > Hello,
>
> >
>
> > I'm using python 3.2.3 and I'm making a program that show
>
> > the of occurrences of the character in the string in
>
> > Tkinter.
>
> >
>
> > My questions are:
>
> >
>
> > How can I make an empty Entry object that will hold a word
>
> > that a user will enter?
>
>
>
> I believe you meant to say: "How can i CREATE an entry field to accommodate user input?"
>
>
>
> Easy.
>
>
>
> > How to make an empty Entry object that will hold a single
>
> > character that the user will enter?
>
>
>
> Not as easy, but still quite doable. Do you want to filter the input, allowing only a single character?
>
>
>
> > How to A Button object with a text equal to "Count"?
>
>
>
> Easy-pee-see. Follow this yellow brick road to enlightenment.
>
>
>
> http://effbot.org/tkinterbook/tkinter-whats-tkinter.htm
Hello,
Here is my try to answer some of questions:
from tkinter import *
class word:
def __init__(self,Entry,Character):
window = Tk()
window.title("Widget")
top = Tk()
L1 = Label(top, text="Enter a string")
L1.pack( side = LEFT)
E1 = Entry(top, bd =5)
E1.pack(side = RIGHT)
top.mainloop()
L2 = Label(bottom, text="Number of single characters")
L2.pack( side = LEFT)
E2 = Entry(bottom, bd =5)
button = Tkinter.Button(bottom, text ="Count", command = countCharacter).pack()
def countChacater(self):
count = word.count(character)
I'm just struggling with only how to create an object that will hold a single character that the user will enter.
More information about the Python-list
mailing list