Tidying up our application

So my last post produced something that did not really look very good. So I have now tidied the code up a little bit to make it look better.

So one of the useful things within this is to adjust the dimensions of our application, so everything fits in to the window area nicely, but not leave too much empty space.

#!/usr/bin/env python
import Tkinter # note use of caps
from Tkinter import *

window = Tk()
window.title('App 1')
window.geometry("600x50") # w x h
window.resizable(0,0)

#define entry box 

entry1 = StringVar() # this is our entry box
entrytext = Entry(window, textvariable=entry1) # this is our entry box
entrytext2 = Entry(window, textvariable=entry1) # this is our second entry box
#define out box 

entry2 = StringVar() # this is our output box
outtext1 = Entry(window, textvariable=entry2) # this is our output box


#display boxes
entrytext.grid(row = 3, column = 2,)  #display entry box
entrytext2.grid(row = 3, column = 3,)  #display entry box
outtext1.grid(row = 3, column = 4,) #display output box


window.mainloop()

So here we have a window, with three text boxes.

app1

Which is starting to look a little better. The main bit of advice I can give here, is test, test and test again, that way you know your application is working as you go.

#tkinter,#python,#gui,#programming.


MastodonPeertubeQoto sign up

Donate using Liberapay