User Profile

Collapse

Profile Sidebar

Collapse
Peter Kr
Peter Kr
Last Activity: Mar 4 '12, 05:19 PM
Joined: Feb 4 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thanks a lot both of you, works now!!!
    Code:
    import Tkinter 
    import Image, ImageTk
    
    def update_image():
            global tkimg1
            tkimg1 = ImageTk.PhotoImage(Image.open('temp.png'))
            label.config( image = tkimg1)
            label.after(1000, update_image)
            print "Updated"
    
    
        
    w = Tkinter.Tk()
    im = Image.open('temp.png')
    tkimg1 = ImageTk.PhotoImage(im)
    ...
    See more | Go to post

    Leave a comment:


  • Oh, right :/
    I am quite common with classes, but tkinter is like a whole new language to me xD
    Thanks, I'll try it as soon as possible :)...
    See more | Go to post

    Leave a comment:


  • I changed the code to this:
    Code:
    import Tkinter 
    import Image, ImageTk
    im = Image.open('temp.png')
    
    def update_image():
        im = Image.open('temp.png')
        tkimage = ImageTk.PhotoImage(im)
        label.config(image=tkimage)
        root.geometry('%dx%d' % (im.size[0],im.size[1]))
        root.after(1000, update_image)
        
    root = Tkinter.Tk()
    im = Image.open('temp.png')
    tkimage
    ...
    See more | Go to post

    Leave a comment:


  • My Problem is that I want to update the image, so if I would for example edit the image, it would change in the window with the next update.
    See more | Go to post

    Leave a comment:


  • Peter Kr
    started a topic Tkinter Reloading Window displaying an Image

    Tkinter Reloading Window displaying an Image

    Hi,
    I've been searching for this on google for a while, but I didn't find anything.
    I want to display an Image inside a Tkinter Window, but the Window should refresh the image every second or so.
    How do I do that?
    My Code so far:
    Code:
    import Tkinter 
    import Image, ImageTk
    
    im = Image.open('temp.png')
    
    root = Tkinter.Tk()
    tkimage = ImageTk.PhotoImage(im)
    ...
    See more | Go to post

  • Peter Kr
    started a topic Get item of a list by index

    Get item of a list by index

    Hey,
    I made a programm that looks like this, but I have a problem.
    Code:
    command = raw_input(">")
    fullcommand = command.split(" ")
    #example user input: >add 10 15
    if fullcommand.index("add") == 0:
    #how I want the rest to work:
    * * *a= fullcommand.getItem(1)
    * * *b= fullcommand.getItem(2)
    * * *c= a + b
    * * *print ("Result: *" + c)
    ...
    See more | Go to post
    Last edited by Peter Kr; Feb 4 '12, 09:25 AM. Reason: Made a mistake in the code
No activity results to display
Show More
Working...