Re: simple splash screen?

2009-07-29 Thread Marcus Wanner

On 7/28/2009 11:58 PM, NighterNet wrote:

I am trying to make a simple splash screen from python 3.1.Not sure
where to start looking for it. Can any one help?

Trying to make a splash screen for python?
Or trying to do image processing in python?

Marcus
--
http://mail.python.org/mailman/listinfo/python-list


Re: simple splash screen?

2009-07-29 Thread Martin P. Hellwig

NighterNet wrote:

I am trying to make a simple splash screen from python 3.1.Not sure
where to start looking for it. Can any one help?


Sure, almost the same as with Python 2 :-)
But to be a bit more specific:

Only works if you got Python 3 installed with tkinter
import tkinter

IMAGE_PATH = /path/to/image

class Splash(object):
Splash Screen GUI
def __init__(self, root):
self.root = root
# No window borders and decoration
self.root.overrideredirect(True)
# Get the size of the screen
screen_width = self.root.winfo_screenwidth()
screen_height = self.root.winfo_screenheight()
# Full screen
geometry_text = %dx%d+0+0 % (screen_width, screen_height)
self.root.geometry(geometry_text)
# Display an image
self.label = tkinter.Label(self.root)
# Only GIF and PGM/PPM supported, for more information see:
self.label._image = tkinter.PhotoImage(file=IMAGE_PATH)
# http://effbot.org/tkinterbook/photoimage.htm
self.label.configure(image = self.label._image)
self.label.pack()
# This will quit the screen after about 5 seconds
self.root.after(5000, self.root.quit)

if __name__ == '__main__':
ROOT = tkinter.Tk()
APPL = Splash(ROOT)
ROOT.mainloop()


--
MPH
http://blog.dcuktec.com
'If consumed, best digested with added seasoning to own preference.'
--
http://mail.python.org/mailman/listinfo/python-list


Re: simple splash screen?

2009-07-29 Thread NighterNet
On Jul 29, 11:16 am, Martin P. Hellwig martin.hell...@dcuktec.org
wrote:
 NighterNet wrote:
  I am trying to make a simple splash screen from python 3.1.Not sure
  where to start looking for it. Can any one help?

 Sure, almost the same as with Python 2 :-)
 But to be a bit more specific:
 
 Only works if you got Python 3 installed with tkinter
 import tkinter

 IMAGE_PATH = /path/to/image

 class Splash(object):
      Splash Screen GUI
      def __init__(self, root):
          self.root = root
          # No window borders and decoration
          self.root.overrideredirect(True)
          # Get the size of the screen
          screen_width = self.root.winfo_screenwidth()
          screen_height = self.root.winfo_screenheight()
          # Full screen
          geometry_text = %dx%d+0+0 % (screen_width, screen_height)
          self.root.geometry(geometry_text)
          # Display an image
          self.label = tkinter.Label(self.root)
          # Only GIF and PGM/PPM supported, for more information see:
          self.label._image = tkinter.PhotoImage(file=IMAGE_PATH)
          #http://effbot.org/tkinterbook/photoimage.htm
          self.label.configure(image = self.label._image)
          self.label.pack()
          # This will quit the screen after about 5 seconds
          self.root.after(5000, self.root.quit)

 if __name__ == '__main__':
      ROOT = tkinter.Tk()
      APPL = Splash(ROOT)
      ROOT.mainloop()
 

 --
 MPHhttp://blog.dcuktec.com
 'If consumed, best digested with added seasoning to own preference.'

Thanks it help. Sorry about that, I was just wander what kind of
answer and if there are other methods to learn it.

Is there a way to position image to the center screen?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simple splash screen?

2009-07-29 Thread Martin P. Hellwig

NighterNet wrote:
cut

Thanks it help. Sorry about that, I was just wander what kind of
answer and if there are other methods to learn it.

Is there a way to position image to the center screen?


Yes there is, just start reading from here:
http://effbot.org/tkinterbook/

Though because Python 3 has done some module reorganisation/renaming, 
Tkinter is now called tkinter.


--
MPH
http://blog.dcuktec.com
'If consumed, best digested with added seasoning to own preference.'
--
http://mail.python.org/mailman/listinfo/python-list