Ich versuche mich an einer GUI für ein kleines Tool das ich geschrieben habe.
So in etwa soll mein Interface am Ende aussehen:
http://dl.dropbox.com/u/17343176/MockUp.jpg
Hier meine Problemchen mit Bildern zur Veranschaulichung:
# Grid
[*] Ich bekomme den Button nicht "neben" den Ladebalken. Er ist immer leicht nach oben versetzt.
[Bild] Falsche Farben & Verschobener Button:
http://dl.dropbox.com/u/17343176/Bildschirmfoto-1.png
[*] Wie kann ich leere Zellen als Abstandshalter nutzen?
[Bild] So stell ich mir das Grid vor - z.B.: Spalte 3 soll eigentlich als "Abstandshalter dienen":
http://dl.dropbox.com/u/17343176/MockUpTable.jpg
#Style
[*] Wenn ich das "Theme" definiere bevor mein root-Fenster erzeugt wird, stimmt zwar überall das Theme, aber der Ladebalken wird
in einem separaten Fenster angezeigt. Ich verstehe nicht warum.
[*] Erzeuge ich erst das root-Fenster und definiere dann das "Theme", ist der Ladebalken genau da wo er sein soll. Die Farben stimmen dann aber nicht.
[Bild] Abgetrennter Ladebalken:
http://dl.dropbox.com/u/17343176/Bildschirmfoto.png
Code:
Code: Alles auswählen
#!/usr/bin/env python3
from tkinter import *
from tkinter import ttk, filedialog, messagebox
start = 0
ende = 0
prg = 100
def calc():
pass
# root Window
root = Tk()
root.geometry("400x170")
root.resizable(FALSE,FALSE)
root.title("NumListGenGUI V0.1 by Geekpirat")
# Style
style = ttk.Style()
style.theme_use("clam")
# Frame
content = ttk.Frame(root, padding = "8 8 8 8")
content.grid(column = 0, row = 0, sticky = (N, W, E, S))
#content.columnconfigure(0, weight = 1)
#content.rowconfigure(0, weight = 1)
# Content // Buttons, Labels ...
ttk.Label(content, text = "Start").grid(column = 1, row = 1, sticky = (SW))
ttk.Label(content, text = "Ende").grid(column = 4, row = 1, sticky = (SW))
ttk.Label(content, text = "Output").grid(column = 1, row = 4, sticky = (SW))
ttk.Label(content, text = "Fortschritt").grid(column = 1, row = 7, sticky = (SW))
start_entry = ttk.Entry(content, width = 10, textvariable = start)
end_entry = ttk.Entry(content, width = 10, textvariable = ende)
start_entry.grid(column = 1, row = 2, sticky = (W))
end_entry.grid(column = 4, row = 2, sticky = (W))
#save_file = filedialog.asksaveasfilename()
#save_file.grid(column = 1, row = 5, sticky = (W))
#messagebox.showinfo(message = " Done! Happy Hacking! :) ")
s = ttk.Separator(content, orient = HORIZONTAL)
s.grid(columnspan = 8 , row = 6, sticky = (W, E))
prg_bar = ttk.Progressbar(mode = "determinate", value = 50, variable = prg, length = 200)
prg_bar.grid(columnspan = 2, row = 8, sticky = (W))
calc_Button = ttk.Button(content, text = "Generate", command = calc)
calc_Button.grid(column = 8, row = 8, sticky = (S))
# Padding 4 all
for child in content.winfo_children():
child.grid_configure(padx = 1, pady = 1)
# Focus, Enter-Key, MainLoop
start_entry.focus()
root.bind('<Return>', calc)
root.mainloop()
Wisst ihr da weiter?
Grüße
Geekpirat