gruß

Das sieht der Screenshot in deinem ersten Posting aber anders ...meister56 hat geschrieben:ich benutze Firefox, da ist das Standart voreingestellt!
Code: Alles auswählen
# testing a notebook widget class for Tkinter (modified)
import Tkinter as tk
class Notebook(object):
"""
a notebook widget class for Tkinter applications
"""
def __init__(self, parent):
self.active_page = None
self.count = 0
self.selected = tk.IntVar(0)
# orientation of initial tab (can go 'bottom' too)
side = 'top'
# new tabs go
self.side= 'left'
# create notebook's initial page frame
self.tab = tk.Frame(parent)
self.tab.pack(side=side, fill='both')
self.page = tk.Frame(parent)
self.page.pack(fill='both')
def __call__(self):
"""
parent page ref
"""
return self.page
def add_page(self, pg, title):
"""
add a new page to the notebook
"""
rb = tk.Radiobutton(self.tab, text=title, indicatoron=0, variable=self.selected,
value=self.count, command=lambda: self.display_page(pg))
rb.pack(fill='both', side=self.side)
# first page is slected by default
if not self.active_page:
pg.pack(fill='both', expand=True)
self.active_page = pg
self.count += 1
# returns reference
return rb
def display_page(self, pg):
"""
shows selected page, hides former page
"""
self.active_page.forget()
pg.pack(fill='both', expand=True)
self.active_page = pg
# testing the module
if __name__ == '__main__':
root = tk.Tk()
root.title('Testing a Tkinter notebook widget')
nb = Notebook(root)
# create first page (notice the call)
page1 = tk.Frame(nb())
nb.add_page(page1, 'page 1')
# put something on the page
# text entry field, width=width in chars, height=lines text
text1 = tk.Text(page1, width=60, height=12, bg='yellow')
text1.pack()
text1.insert(tk.INSERT, ' this is page number 1')
# create second page
page2 = tk.Frame(nb())
nb.add_page(page2, 'page 2')
# put something on the page
text2 = tk.Text(page2, width=60, height=12, bg='green')
text2.pack()
text2.insert(tk.INSERT, ' this is page number 2 \n Look, I am green!')
button2 = tk.Button(page2, text='save text to file') # just a dummy for testing
button2.pack(side='left')
root.mainloop()
kein thema.meister56 hat geschrieben:genau so etwas habe ich gesucht!! vielen dank!!
Tut mir leid, aber sowas muss ich einfach korrigieren!meister56 hat geschrieben:das ist auch recht gut, habe aber schon die das programm mit der ersten möglichkeit vertiggestellt!