The value of the entry widget doesn't get updated

2005-04-19 Thread Clara
Hi, can somebody help me,..I have an assignment due next week but now
I'm stuck with this problem
I tried to get values from entry widget using the
widgetcontrolvariable.get(),..but it seems that it won't work
I can't print the value I input in the entry widget...However when I
first set the value to something I can get the value just fine...
This is my code
Help please...

msg='*~*Please Login to use the system*~*'
class LoginMenu(Frame):

def createWidgets(self, msg):
import tkFont
self.x = StringVar()
self.y = StringVar()
self.x.set("Type here") 
self.messageLabel= Label(self, text=msg, pady=15,
font=tkFont.Font(weight='bold' ,size=10))
self.messageLabel.grid(row=0, columnspan=6)
self.nameLabel= Label(self, text='UserName  :', padx=12,
justify=LEFT)
self.nameLabel.grid(row=1, column=0, ipadx=9, ipady=5)
self.nameEntry= Entry(self,justify=LEFT, textvariable=self.x)
self.nameEntry.grid(row=1, column=3, columnspan=2)
self.nameEntry.update_idletasks()
self.passLabel= Label(self, text='Password   :', padx=12,
justify=LEFT)
self.passLabel.grid(row=2, column=0,ipadx=9, ipady=5)
self.passEntry= Entry(self,justify=LEFT, show='*',
textvariable=self.y)
self.passEntry.grid(row=2, column=3, columnspan=2)
self.passEntry.update_idletasks()
self.loginButton = Button(self, text='Login', command =
VerifyProcessor(self.x.get(), self.y.get()) )
self.loginButton.grid(row=4, column=3, ipadx=15, ipady=3, 
pady=20)
self.quitButton = Button(self, text='Exit', command = 
self.quit) 
self.quitButton.grid(row=4, column=4, ipadx=20, ipady=3, 
pady=20,
padx=10)

def __init__(self, msg, master=None):
Frame.__init__(self, master)
self.grid(column=4, row=4)
self.createWidgets(msg)

class VerifyProcessor:

def __init__(self, thename, thepass):
self.username = thename
self.password = thepass

def __call__(self):
print self.username
print self.password


app = LoginMenu(msg)
app.master.title("Login Menu")
app.master.maxsize(280,200)
app.mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Thanks

2005-04-19 Thread Clara
Yes that solves my problem all right...THanks a bunch to both of you

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The value of the entry widget doesn't get updated

2005-04-19 Thread Clara
Yes that solves my problem all right...THanks a bunch to both of you

-- 
http://mail.python.org/mailman/listinfo/python-list


Entry Value won't get updated...Help please

2005-04-19 Thread Clara
I tried to print the value of my entry widget by passing the
result of controlvariable.get() in Tkinter to a function.
However, I kept printing empty string (eventhough I've
written something inside the  entry widget). But if I first
set the value of the entry widget using .set,...I can get
the value just fine...Anybody knows why??
-- 
http://mail.python.org/mailman/listinfo/python-list


opening new window in one window using Tkinter -- Help please

2005-04-24 Thread Clara
Hi,...
I meant to write an application where there is a button in a window and
when you click on the button, it will open a new window, but I want the
first window to close, replaced by the second window.
I open a login window and start the mainloop, when the user click on
the login button, the __call__ function of VerifyProcessor is executed
and it will call the new window which is the file manager window
The thing is,.. I don't know how to exit the first mainloop and then
display the second window...I even tried calling the mainloop again but
a weird thing happens. I really need help because otherwise I'm stuck
here and I can't complete my assignment. The following is my code:

from login import LoginMenu
app = LoginMenu()
app.master.title("Login Menu")
app.master.maxsize(300,200)
app.mainloop()
==
class LoginMenu(Frame):

def createWidgets(self):
 self.loginButton = Button(self, text='Login', command =
VerifyProcessor(self.x, self.y, self.msg, self.messageLabel) )

def __init__(self, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=4)
self.createWidgets()

class VerifyProcessor:

def __init__(self, thename, thepass, msg, msglabel):
self.username = thename
self.password = thepass
self.msgVar = msg
self.msgLabel = msglabel

def __call__(self):
import md5
import dictionaryloader
found = 0
theDict = dictionaryloader.loadFrom("Dicttxt")
entries = theDict.items()
for theuser, thepass in entries:
if self.username.get() == theuser and
md5.new(self.password.get()).hexdigest() == thepass:
found=1
from mainmenu import FileManager
app2 = FileManager(self.username.get())
app2.master.title("File Manager")
app2.master.maxsize("400,1500")
app2.mainloop()
=
class FileManager(Frame):

def createWidgets(self, username):
   ...
def __init__(self, username, master=None):
Frame.__init__(self, master)
self.grid(column=6, row=6)
self.createWidgets(username)
==

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: opening new window in one window using Tkinter -- Help please

2005-04-24 Thread Clara
Well, but where do I call withdraw?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: opening new window in one window using Tkinter -- Help please

2005-04-24 Thread Clara
Forgive my ignorance, but where do I call withdraw?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: opening new window in one window using Tkinter -- Help please

2005-04-24 Thread Clara
since the file where i call the first window and the second window is
different,.If I put app.master.withdraw() there,...won't I get error
message that says; app is not defined as global or something like that?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: opening new window in one window using Tkinter -- Help please

2005-04-24 Thread Clara
I've found the solution I must destroy the first window using
self.master.destroy(), but thanks anyway ^_^

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Clara Spealman via Python-list
All methods are functions, but not all functions are methods. All methods
are functions in the namespace of a class and when resolved from the class
directly, you'll get the original function. Its only when resolved from an
*instance* of the class, as in self.__init__ or self.any_other_method(),
that the function is wrapped in a method object, which is callable and
binds the function to the particular instance passed as "self".

So the simple answer is "its both". The only slightly less simple answer is
"its both, depending on how you're getting it."

On Fri, Sep 15, 2023 at 6:53 AM scruel tao via Python-list <
python-list@python.org> wrote:

> ```python
> >>> class A:
> ...   def __init__(self):
> ... pass
> ...
> >>> A.__init__
> 
> >>> a = A()
> >>> a.__init__
> >
> ```
>
> On many books and even the official documents, it seems that many authors
> prefer to call `__init__` as a "method" rather than a "function".
> The book PYTHON CRASH COURSE  mentioned that "A function that’s part of a
> class is a method.", however, ` A.__init__` tells that `__init__` is a
> function...
>
> I wonder how can I call `__init__` as? Consider the output above.
> Maybe both are OK? If you prefer or think that we must use one of the two,
> please explain the why, I really want to know, thanks!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

calvin.speal...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list