Display image on root page of the notebook in python tkinter -
i designing gui window project. in want display image on notebook root page (so although tab active, image seen) have programmed in python using tkinter. didnt find way adding image on root page. code below:
title = 'trial tool window' # import pmw directory tree. import sys sys.path[:0] = ['../../..'] import tkinter import pmw class mybutton(tkinter.button): def __init__(self, master=none, cnf={}, **kw): self.__toggle = 0 apply(tkinter.button.__init__, (self, master, cnf), kw) class demo: def __init__(self, parent): # create , pack notebook. notebook = pmw.notebook(parent) notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10) page = notebook.add('aaaa') notebook.tab('aaaa').focus_set() # create "toolbar" contents of page. group = pmw.group(page, tag_text = 'xyz') group.pack(fill = 'both', expand = 1, padx = 10, pady = 10) b1 = tkinter.checkbutton(group.interior(), text = 'show tool') b1.grid(row = 0, column = 0) # add other channel pages. page = notebook.add('bbbb') page = notebook.add('cccc') page = notebook.add('dddd') page = notebook.add('eeee') page = notebook.add('ffff') page = notebook.add('gggg') page = notebook.add('hhhh') page = notebook.add('iiii') page = notebook.add('jjjj') page = notebook.add('kkkk') page = notebook.add('llll') page = notebook.add('mmmm') page = notebook.add('nnnn') page = notebook.add('oooo') page = notebook.add('pppp') page = notebook.add('qqqq') page = notebook.add('rrrr') notebook.setnaturalsize() ###################################################################### # create demo in root window testing. if __name__ == '__main__': root = tkinter.tk() pmw.initialise(root) root.title(title) widget = demo(root) exitbutton = mybutton(root, text = 'exit', command = root.destroy) exitbutton.pack() root.mainloop()
also image should in .ico format or other format applicable?
attached snapshot of required style (marked red). ).
Comments
Post a Comment