Tkinter resize
Megint elővettem a Tkintert, hogy ismerkedjek vele. (Egyszer már belebuktam vagy egy éve :)) Akkor valahonnan letöltöttem egy mintát, amin egy frame-ben van editálható szövegmező, gombok, beviteli ablak, szóval efféle alapdolgok, hogy piszkálgathassam.
Akkor is azon buktam meg, hogy ez a frame átméretezhető volt ugyan alapból, de a benne levő szövegmező ugyanakkora méretű maradt és így nagyon gáz.
1. Nem találok megfelelő metódust hozzá: resize vagy hasonló szinonimákat keresek. Förmedjetek rám, hogy nem is úgy kell, csak akkor hogyan?
2. A .grid használatával nem saját magam akadályozom az átméretezhetőséget?
Szerk.: Hogy ne csak a levegőbe beszéljek, az ide vágó részlet:
root = Tk()
root.title("System beta version")
root.usrtext = Text(root, bg = "light yellow", fg = "black",relief=SUNKEN)
root.usrtext.grid(row=0, columnspan=16, rowspan=2, sticky=W+E+N+S, padx=5, pady=5)
root.fname = StringVar()
root.fname = ""
filestring = StringVar()
root.last_saved_text=StringVar()
root.last_saved_text=""
root.compiled_text=StringVar()
root.compiled_text=""
cimke1 = Label(root, text="Variable:").grid(row=3, sticky=W, padx=5)
cimke2 = Label(root, text="Value:").grid(row=4, sticky=W, padx=5)
cimke3 = Label(root, text="Subroutine:").grid(row=5, sticky=W, padx=5)
cimke4 = Label(root, textvariable=filestring, font=("Arial Black", 10)).grid(row=6, columnspan=16, padx=5, sticky=W)
mezo1 = Entry(root, bg = "light cyan", fg = "black", relief=SUNKEN)
mezo1.grid(row=3, column=1, sticky=W)
mezo2 = Entry(root, bg = "light cyan", fg = "black", relief=SUNKEN)
mezo2.grid(row=4, column=1, sticky=W)
mezo3 = Entry(root, bg = "light cyan", fg = "black", relief=SUNKEN)
mezo3.grid(row=5, column=1, sticky=W)
gomb1 = Button(root, text='Read', height=1, width=4, relief=RAISED, command=readvar)
gomb1.grid(row=3, column=2)
gomb2 = Button(root, text='Write', height=1, width=4, relief=RAISED, command=writevar)
gomb2.grid(row=4, column=2)
gomb3 = Button(root, text='Execute', height=1, width=4, relief=RAISED, command=executesub)
gomb3.grid(row=5, column=2)
gomb4 = Button(root, text='Run / load', height=1, width=10, relief=RAISED, command=compile)
gomb4.grid(row=4, column=14)
app = App(root)
i=DeviceExplore()
errorstring=DeviceVersnr()
if (i==0):
errorstring=DeviceVersnr()
if showerror('Error !','There is no connection\n%s.' % errorstring):
root.destroy()
if (i==-1):
errorstring='Chip was found but cannot be claimed'
if showerror('Error !','%s' % errorstring):
root.destroy()
if (i>1):
errorstring='Conflict: more than one chip was found'
if showerror('Error !','%s' % errorstring):
root.destroy()
if (i==1):
DeviceSetMyBuffer(root.usrtext.get(1.0,END))
root.mainloop()
- Tovább (Tkinter resize)
- 2621 megtekintés