Re: [Tutor] Modifying Grayson's Example 5_14
Martin Walsh wrote: Wayne Watson wrote: it. It works pretty well, but puts up a a few probably top level windows that are blank. How do I get around them, and is there anything root = Tk() Try adding this, root.withdraw() dialog = GetPassword(root) HTH, Marty Wayne Watson wrote: That worked. Why the extra blank window though? I'm no Tkinter expert -- far from it. But I would assume that GetPassword, as a subclass of Dialog, creates a new window, and thus you have no need for the root window. root.withdraw() hides the root window from view, and allows the application to continue running. I imagine there are other ways to accomplish the same thing. HTH, Marty ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Modifying Grayson's Example 5_14
Title: Signature.html I thought I'd explore Tkinter a bit more before diving into widget design. Grayson has some examples on the web, which look like they could help a bit. He uses Pmw, so I thought I'd just remark out the import for it. It works pretty well, but puts up a a few probably top level windows that are blank. How do I get around them, and is there anything else I should be aware of in this code? It produces a small dialog for entering a new pwd. # Grayson 5_14.py from Tkinter import * from tkSimpleDialog import Dialog import tkMessageBox #import Pmw class GetPassword(Dialog): def body(self, master): self.title("Enter New Password") Label(master, text='Old Password:').grid(row=0, sticky=W) Label(master, text='New Password:').grid(row=1, sticky=W) Label(master, text='Enter New Password Again:').grid(row=2, sticky=W) self.oldpw = Entry(master, width = 16, show='*') self.newpw1 = Entry(master, width = 16, show='*') self.newpw2 = Entry(master, width = 16, show='*') self.oldpw.grid(row=0, column=1, sticky=W) self.newpw1.grid(row=1, column=1, sticky=W) self.newpw2.grid(row=2, column=1, sticky=W) return self.oldpw def apply(self): opw = self.oldpw.get() npw1 = self.newpw1.get() npw2 = self.newpw2.get() if not npw1 == npw2: tkMessageBox.showerror('Bad Password', 'New Passwords do not match') else: # This is where we would set the new password... pass root = Tk() dialog = GetPassword(root) -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) Life is one damn thing after another." -- Mark Twain ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Modifying Grayson's Example 5_14
Wayne Watson wrote: ... it. It works pretty well, but puts up a a few probably top level windows that are blank. How do I get around them, and is there anything ... root = Tk() Try adding this, root.withdraw() dialog = GetPassword(root) HTH, Marty ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Modifying Grayson's Example 5_14
Title: Signature.html That worked. Why the "extra" blank window though? Martin Walsh wrote: Wayne Watson wrote: it. It works pretty well, but puts up a a few probably top level windows that are blank. How do I get around them, and is there anything root = Tk() Try adding this, root.withdraw() dialog = GetPassword(root) HTH, Marty ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) Life is one damn thing after another." -- Mark Twain ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor