python tkinter gui
Posted
by
Lewis Townsend
on Stack Overflow
See other posts from Stack Overflow
or by Lewis Townsend
Published on 2012-11-08T20:23:07Z
Indexed on
2012/11/12
11:01 UTC
Read the original article
Hit count: 264
I'm wanting to make a small python program for yearly temperatures. I can get nearly everything working in the standard console but I'm wanting to implement it into a GUI.
The program opens a csv file reads it into lists, works out the average, and min & max temps. Then on closing the application will save a summary to a new text file.
I am wanting the default start up screen to show All Years. When a button is clicked it just shows that year's data.
Here is a what I want it to look like.
Pretty simple layout with just the 5 buttons and the out puts for each.
I can make up the buttons for the top fine with:
Code:
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.hi_there = Button(frame, text="All Years", command=self.All)
self.hi_there.pack(side=LEFT)
self.hi_there = Button(frame, text="2011", command=self.Y1)
self.hi_there.pack(side=LEFT)
self.hi_there = Button(frame, text="2012", command=self.Y2)
self.hi_there.pack(side=LEFT)
self.hi_there = Button(frame, text="2013", command=self.Y3)
self.hi_there.pack(side=LEFT)
self.hi_there = Button(frame, text="Save & Exit", command=self.Exit)
self.hi_there.pack(side=LEFT)
I'm not sure as to how to make the other elements, such as the title & table.
I was going to post the code of the small program but decided not to. Once I have the structure/framework I think I can populate the fields & I might learn better this way.
Using Python 2.7.3
© Stack Overflow or respective owner