[Tkinter-discuss] String-names and the NoteBook entryfield
Chris Nethery
clnethery at juno.com
Tue Sep 21 04:38:54 CEST 2004
Hello everyone. I have an issue that is causing me many anxious moments. So, at long last, I feel I need to refer to the experts.
I am trying to create a Pmw.NoteBook instance that the user names as he/she creates it. Specifically, I am trying to enable the user to name the NoteBook instance in its own entryfield, similar to creating a new Tree node in Windows Explorer or a new Windows folder or shortcut icon, for example. Secondly, I am having a hard time associating the input string name with the NoteBook instance. Unfortunately, I have gone through many cycles trying to make things work, and the code has broken each time, so I have included just the base code that (almost) works. Any ideas on this one?
Thanking you in advance,
Christopher Nethery
### imports ###
from Tkinter import *
from Tkconstants import *
import Pmw
### initialization ###
root = Tk()
root.wm_geometry("1015x705")
Pmw.initialise(root)
### notebooks ###
class MyWidgets:
def __init__(self, root):
self.root = root
Mainframe = Frame(self.root)
Mainframe.pack(fill='both', expand=1, padx=1, pady=1)
self.Notebook = Pmw.NoteBook(Mainframe, createcommand=self.curse_Selection)
self.Notebook.pack(fill='both', expand=1, padx=1, pady=1)
self.nameEntryField = Pmw.EntryField(self.Notebook.tab(""), label_font=(('Verdana'), '7'), labelpos=W, labelmargin=0, label_text='Stuff:')
self.nameEntryField.pack(fill='both', expand=1, padx=1, pady=1)
fieldEntry = self.nameEntryField.component('entry').get()
self.NotebookPage1 = self.Notebook.add(fieldEntry)
self.NotebookPage1.pack(fill='both', expand=1, padx=1, pady=1)
self.NotebookPage1Frame = Frame(self.NotebookPage1, borderwidth=2, width=975, height=650, relief=GROOVE)
self.NotebookPage1Frame.pack(fill='both', expand=1, padx=1, pady=1)
def curse_Selection(self, notebook):
pass
if __name__=='__main__':
mw = MyWidgets(root)
root.mainloop()
More information about the Tkinter-discuss
mailing list