Schritt für Schritt

Hauptfenster erstellen:

import tkinter as tk
from tkinter import *
root=Tk()
root.mainloop()

Hauptmenu erstellen:

import tkinter as tk
from tkinter import messagebox
from tkinter.filedialog import askopenfilename

def NewFile():
print("Neue Datei erstellt.")

def OpenFile():
filename = askopenfilename()
print("Datei geöffnet:", filename)

def About():
messagebox.showinfo("Über", "Dies ist ein Beispielprogramm.")

root = tk.Tk()
menu = tk.Menu(root)
root.config(menu=menu)

filemenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Datei", menu=filemenu)
filemenu.add_command(label="Neu", command=NewFile)
filemenu.add_command(label="Öffnen…", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Beenden", command=root.quit)

helpmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Hilfe", menu=helpmenu)
helpmenu.add_command(label="Über…", command=About)

root.mainloop()

Größe des Fensters und einen Label festlegen

import tkinter as tk
#from tkinter import messagebox
#from tkinter.filedialog import askopenfilename
#from tkinter import simpledialog
from tkinter import *

def NewFile():
    print("Neue Datei erstellt.")

def OpenFile():
    filename = askopenfilename()
    print("Datei geöffnet:", filename)

def About():
    messagebox.showinfo("Über", "Dies ist ein Beispielprogramm.")

root = tk.Tk()
root.geometry('300x500')
menu = tk.Menu(root)
title="Entwicklung Typeitin"
root.config(menu=menu)

filemenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Datei", menu=filemenu)
filemenu.add_command(label="Neu", command=NewFile)
filemenu.add_command(label="Öffnen...", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Beenden", command=root.quit)

helpmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Hilfe", menu=helpmenu)
helpmenu.add_command(label="Über...", command=About)

w=Label(root, text="Button Bezeichnung eingeben", bg="red", fg="white")
w.pack(fill=X, padx=20 )


root.mainloop()

Eingabefeld anlegen und Button definieren

import tkinter as tk
from tkinter import *

def NewFile():
    print("Neue Datei erstellt.")

def OpenFile():
    filename = askopenfilename()
    print("Datei geöffnet:", filename)

def About():
    messagebox.showinfo("Über", "Dies ist ein Beispielprogramm.")
def show_entry_fields():
    print ("wird noch festgelegt")    

root = tk.Tk()
root.geometry('300x500')
menu = tk.Menu(root)
title="Entwicklung Typeitin"
root.config(menu=menu)
filemenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Datei", menu=filemenu)
filemenu.add_command(label="Neu", command=NewFile)
filemenu.add_command(label="Öffnen...", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Beenden", command=root.quit)
helpmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Hilfe", menu=helpmenu)
helpmenu.add_command(label="Über...", command=About)

w=Label(root, text="Button Bezeichnung eingeben", bg="red", fg="white")
w.pack(fill=X, padx=20 )
e1=Entry(root)
e1.pack()
Button(root, text='Exit', command=root.quit).pack()
Button(root, text='ok', command=show_entry_fields).pack()
root.mainloop()

Text Widget hinzufügen

t =tk.Text(window, width=20, height=3)

import tkinter as tk
from tkinter import *

def NewFile():
    print("Neue Datei erstellt.")

def OpenFile():
    filename = askopenfilename()
    print("Datei geöffnet:", filename)

def About():
    messagebox.showinfo("Über", "Programm erstellt von Mandy Seider")
def show_entry_fields():
    print ("wird noch festgelegt")    
def save():
    print ("wird noch festgelegt")    

root = tk.Tk()
root.geometry('300x500')
menu = tk.Menu(root)
title="Entwicklung Typeitin"
root.config(menu=menu)
filemenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Datei", menu=filemenu)
filemenu.add_command(label="Neu", command=NewFile)
filemenu.add_command(label="Öffnen...", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Beenden", command=root.quit)
helpmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Hilfe", menu=helpmenu)
helpmenu.add_command(label="Über...", command=About)

w1=Label(root, text="Button Bezeichnung eingeben")
w1.pack(fill=X, padx=20 )
e1=Entry(root)
e1.pack()
w2=Label(root, text="dazugehörigen Text eingeben")
w2.pack()
# Text Widget 
t1 = tk.Text(root, width=20, height=3) 
t1.pack()
Button(root, text='Exit', command=root.quit).pack()
Button(root, text='Speichern', command=save()).pack()
root.mainloop()

Möglichkeit der Speicherung der Daten einrichten

json

import tkinter as tk
from tkinter import *
from tkinter import messagebox, filedialog
import json

def NewFile():
    print("Neue Datei erstellt.")

def OpenFile():
    filename = filedialog.askopenfilename()
    print("Datei geöffnet:", filename)

def About():
    messagebox.showinfo("Über", "Programm erstellt von Mandy Seider")

def show_entry_fields():
    print ("wird noch festgelegt")    
    
def save():
    daten = {
        "bezeichnung": e1.get(),
        "text": t1.get("1.0", tk.END).strip()
    }
    with open("data.json", "w", encoding="utf-8") as f:
        json.dump(daten, f, ensure_ascii=False, indent=4)
    messagebox.showinfo("Gespeichert", "Daten wurden in data.json gespeichert.")
    
root = tk.Tk()
root.geometry('300x500')
menu = tk.Menu(root)
title="Entwicklung Typeitin"
root.config(menu=menu)
filemenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Datei", menu=filemenu)
filemenu.add_command(label="Neu", command=NewFile)
filemenu.add_command(label="Öffnen...", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Beenden", command=root.quit)
helpmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Hilfe", menu=helpmenu)
helpmenu.add_command(label="Über...", command=About)

w1=Label(root, text="Button Bezeichnung eingeben")
w1.pack(fill=X, padx=20 )
e1=Entry(root)
e1.pack()
w2=Label(root, text="dazugehörigen Text eingeben")
w2.pack()
t1 = tk.Text(root, width=20, height=3) 
t1.pack()
Button(root, text='Exit', command=root.quit).pack()
Button(root, text='Speichern', command=save).pack() 
root.mainloop()