Need a Little Help on Tkinter and Python

W. Watson wolf_tracks at invalid.com
Tue Jun 5 19:58:04 EDT 2007


I have about a 1600 line Pythron program I'd like to make some simple mods 
to, but have really just a nodding acquaintance with Python and Tkinter. I 
know quite a few languages, including C++. Let's change that. I've not used 
anything but C in recent years, and C++ was in my bag before that along with 
a number of aged languages.

The biggest change I want to make is the single simple screen titles, top 
and bottom. The top was easy, since it had one word. Although, it might be 
good to center the title. The title at the bottom really is a file name that 
changes as data is examined. Here's the general lay of the land. Any clues 
to what needs to be done? is there a Tkinter intro manual somewhere> I have 
a very short Python pdf that mostly deals with Python in terms of a script 
language. It's maybe 60 pages long. BTW, is there a Main, or where does the 
executable first start?

-----------------------------------
|Title line
|Menu line (pull downs)
|
|
|Image area of a picture of the sky
|
|
|Bottom line with <-, ->, ->||, etc. scroll tools plus the current file name
|   on display. There's a delete button there too, along with camera on/off.
----------------------------------

Each time a camera takes a picture of the sky, it appears in the image area. 
  Images are taken randomly about every 10-15 minutes for the night. An 
operator can use the scroll tools to go sequentially up and down the images 
at any time. Each time a new image file appears, the file name is updated. 
They are of the form v20070612_183015b.dat. Year, month, date, hour, min, 
sec. I want to change or add somewhere on the line just the date and time in 
bold or in some color:  05/12/07 at 13:30:15 for the above.

Here's an excerpt of a data structure that probably is key to the display:

     def __init__(self, master):
         self.master = master
         master.title( MAIN_TITLE )
         self.running = True
         self.channel = None
         self.reference_image = None
         self.current_image = None
         self.subimages = None
         self.current_path = None
         self.current_image_data = None
         self.current_subimage_data = None
         ...

and some code:
         self.previousButton = Button(botmain,text="<<-",state=NORMAL,
                                     font=("Courier",8),
                                     command=self.PlayPrevious,
                                     takefocus=0)
         self.previousButton.grid(row=0,column=5,sticky=W)

         self.nextButton = Button(botmain,text="->>",state=NORMAL,
                                     font=("Courier",8),
                                     command=self.PlayNext,
                                     takefocus=0)
         self.nextButton.grid(row=0,column=6,sticky=W)

         self.lastButton = Button(botmain,text=">||",state=NORMAL,
                                     font=("Courier",8),
                                     command=self.PlayLast,
                                     takefocus=0)
         self.lastButton.grid(row=0,column=7,sticky=W)

         self.replayButton = Button(botmain,text="Replay",state=NORMAL,
                                     command=self.Replay,
                                     takefocus=0)
         self.replayButton.grid(row=0,column=8,sticky=W)

         self.compositeButton = Button(botmain,text="Composite",state=NORMAL,
                                     command=self.Composite,
                                     takefocus=0)
         self.compositeButton.grid(row=0,column=9,sticky=W)

         self.deleteButton = Button(botmain,text="Delete",state=NORMAL,
                                     command=self.Delete,
                                     takefocus=0)
         self.deleteButton.grid(row=0,column=10,sticky=W)

         self.MakeSelectsAndWeights()

         self.Focus()

-- 
                          Wayne Watson (Nevada City, CA)

                        Web Page: <speckledwithStars.net>



More information about the Python-list mailing list