Tk window and contents will not display
Peter Otten
__peter__ at web.de
Sat Aug 14 19:46:20 EDT 2010
Chris Hare wrote:
>
> On Aug 14, 2010, at 5:49 PM, Peter Otten wrote:
>
>> Chris Hare wrote:
>>
>>> Thanks Peter. I threw away what I started with and merged your code
>>> into my class:
>>>
>>> class externalLoopDisplay:
>>>
>>> def show(self):
>>> main.logging.debug("externalLoopDisplay.show:","start")
>>>
>>> self.window = Tk()
>>>
>>> self.btnClose = Button(self.window, text="Close",
>>> command=self.window.destroy,
>>> bg=backColor,highlightbackground=warnColor,
>>> highlightcolor=okColor) self.btnClose.grid(row=0, column=2)
>>> self.label = Label(self.window) self.label.grid(row=1, column=0,
>>> columnspan=3)
>>> dirName = getRadarPath() + "/net" + str(netNumber.get()) # e.g.
>>> .../Radar/net17/net17-YYYYMMDDHHMMSS.gif
> Thanks. One final question if I may, how would you suggest I handle
> checking for new files and adding them to the list? For example, if the
> loop is playing and a new image is added, how can I detect it and then
> refresh the list of file?
>
> I am stuck on that part with this new approach.
>
> Chris
Replacing
>>> self.imagefiles = glob.glob(dirName + "/*.gif")
>>> self.imagefiles = cycle(self.imagefiles)
with
self.imagefiles = image_cycler(os.path.join(dirname, "*.gif"))
where image_cycler() looks as follows
def image_cycler(pattern):
while True:
for fn in glob.glob(pattern):
yield fn
would be the simplest way.
Peter
More information about the Python-list
mailing list