On Mar 19, 8:25 pm, maiden129 wrote:
Here is my try to answer some of questions:
I don't understand why you are wrapping this code into a class. Are
you trying to create something reuseable?
I'm just struggling with only how to create an object that
will hold a single character that the user will enter.
I would suggest that you scrape this code and start over, and a good
starting point would be at the BEGINNING.
All (well, *most*) GUI applications begin with a "root window". Once
you have created the main window you can start placing widgets inside
the window. This is the basic outline of a Tkinter GUI application.
1. Create the root window.
2. Create all the needed sub-widgets and arrange them properly.
3. Start processing user events.
So using the code you provided (and rearranging it to make sense) you
would end up with this:
## START CODE ##(Python 3.x)
import tkinter as tk
from tkinter.constants import LEFT
print('I should do something here!')
root = tk.Tk()
w=tk.Label(root, text="Enter a string")
e1 = tk.Entry(root, bd=5)
b=tk.Button(root, text="Count", command=cbButton)
## END CODE ##
Notice that i used a more intelligent form of import that will
maintain a clean namespace. Tkinter is a very BLOATED module, and
since you are just learning you won't be aware of the names that could
Also notice that my style is consistent. Not following an accepted
coding style is condemnable, however, being inconsistent with your
style is abominable!
PS: Also, trim those excessive quotes please.