I'm trying now to get a preference dialog in my AddImgasSVG plugin.
So i had a look at DiapDealers TagMechanic but failed, what i could achieve is a dialog window but without a simple button
So i'm trying to find a tutorial but none was so simple that even i was able to understand it.
I would like to have a separate class so i started creating one derived from TopLevel. What i currently dont understand is why do i need to call the Grame Method to put a button in it? DiapDealer created a box, and inside the box a second frame for the buttons and here i give up.
So: are there tutorials dealing with this? I was unable to find one, most of them are just opening a window and this is what i have already. I would like to have a fourth Button - no problem.
Took some code from DiapDealer (which i didnt understand), i got a window but the simple button i added doesnt show up. As i'm not getting any error message i dont know what i'm doing wrong.
What i have "stolen" so far;
Code:
class PrefDialog(tkinter.Toplevel):
def __init__(self, parent):
tkinter.Toplevel.__init__(self, parent)
self.resizable(False, False)
self.title('Preferences')
self.parent = parent
self.initUI()
def initUI(self):
body = tkinter.Frame(self)
body.pack(fill=tkinter_constants.BOTH)
buttons = tkinter.Frame(body)
cancelButton = tkinter.Button(buttons, text='Done', command=self.cmdDo)
cancelButton.pack(side=tkinter_constants.LEFT, fill=tkinter_constants.BOTH, expand=True)
self.withdraw()
self.transient(self.parent)
self.grab_set()
self.center()
self.deiconify()
self.maingui.wait_window(self)
The result can be seen in the attachment