[Tutor] Cackling with Maniac Laughter (was: starting a tkinter window maximized)

kromag@nsacom.net kromag@nsacom.net
Thu, 3 May 2001 16:08:24 -0700 (PDT)



> wm_state('zoomed') should maximize on Windows.  For example:
> 
>     >>> import os
>     >>> from Tkinter import *
>     >>> class MaxWin(Tk):
>     ...        def __init__(self):
>     ...            Tk.__init__(self)
>     ...            Label(self, text = "Test Zoom").pack()
>     ...            if os.name == 'nt':
>     ...                self.wm_state('zoomed')
>     ...
>     >>> test = MaxWin()
>     >>> test.mainloop()
> 
> This produced a full size window with a label.

Thanks! I'll try it!

The only problem I can see is that I already have a class declared to put in 
a ScrolledCanvas (maybe I should have mentioned that. Sorry.)

To wit:

#!/usr/bin/python
from Tkinter import *
class ScrolledCanvas(Frame):
	def __init__(self, parent=None, color='white'):
		Frame.__init__(self, parent)
		self.pack(expand=YES, fill=BOTH)
		self.photo=PhotoImage
(file="\windows\desktop\screensaver\wacky3.gif")
		
		canv=Canvas(self, bg=color, relief=SUNKEN)
		canv.config(width=1000, height=700)
		canv.config(scrollregion=(0,0, 300, 1000))
		canv.create_image(10,10, image=self.photo, anchor=NW)

		sbar=Scrollbar(self)
		sbar.config(command=canv.yview)
		canv.config(yscrollcommand=sbar.set)
		sbar.pack(side=RIGHT, fill=Y)
		canv.pack(side=LEFT, expand=YES, fill=BOTH)
		Button(text="quit", command=self.quit).pack(fill=X)
if __name__ == '__main__':ScrolledCanvas().mainloop()

 <stuff removed>

> I don't suggest
> you do this though, because I've had some Unix users tell me maximizing an
> app is very rude.

Good heavens yes it is rude. Unfortunately I am stuck with Win9x for this 
particular experiment! :-) 

What I am trying to do is pop up a window as a screen saverish app that 
displays information rather than a cute bouncing whatsis. I 'compiled' the 
program with py2exe (a wonderful program!) then switched it's extention 
to .scr. Walla! A badly-behaved screensaver! 

I cackled with Maniac Laughter as as my little script popped up after 60 
seconds! :-)

Now all I have to do is come up with code that will only allow one instance 
of the program to run at a time (I know I saw something to the effect in one 
of my Python books, so no one answer this till I give up! ;-)

Of the five parts of the windows screensaver API, I need:

1. provide a description of itself 
2. distinguish between active mode and configuration mode 
3. disallow multiple copies of itself to run 

I just got "Python Programming for Win32", so I hope the answers lie therin. 
(If I can keep from playing with the cool accounting examples he is starting 
us out with. I never thought that stuff would be this interesting....)

Thanks so much!

d

> 
> Good luck,
> Sam
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>