update tkinter window with gif












0















import tkinter as tk
import time
from tkinter import *
from tkinter import messagebox
from time import sleep
from PIL import Image, ImageTk
from itertools import count
from time import sleep

class ImageLabel(tk.Label):

def load(self, im):
if isinstance(im, str):
im = Image.open(im)
self.loc = 0
self.frames =

try:
for i in count(1):
self.frames.append(ImageTk.PhotoImage(im.copy()))
im.seek(i)

except EOFError:
pass

try:
self.delay = im.info['10']
except:
self.delay = 100

if len(self.frames) == 1:
self.config(image=self.frames[0])
else:
for i in range(1):
self.next_frame()

def unload(self):
self.config(image=None)
self.frames = None

def next_frame(self):
if self.frames:
self.loc += 1
self.loc %= len(self.frames)
self.config(image=self.frames[self.loc])
self.after(self.delay, self.next_frame)

root = tk.Tk()
root.geometry('400x200')
root.title("מערכת הסבת וואלה מייל")
lbl = ImageLabel(root)
lbl.pack()
lbl.load('Logo.gif')


I ran this code and I don't know how to update the tkinter win after one shows the gif.



Can someone help me and tell me how to do this? I tried many things and I don't know what to do.










share|improve this question





























    0















    import tkinter as tk
    import time
    from tkinter import *
    from tkinter import messagebox
    from time import sleep
    from PIL import Image, ImageTk
    from itertools import count
    from time import sleep

    class ImageLabel(tk.Label):

    def load(self, im):
    if isinstance(im, str):
    im = Image.open(im)
    self.loc = 0
    self.frames =

    try:
    for i in count(1):
    self.frames.append(ImageTk.PhotoImage(im.copy()))
    im.seek(i)

    except EOFError:
    pass

    try:
    self.delay = im.info['10']
    except:
    self.delay = 100

    if len(self.frames) == 1:
    self.config(image=self.frames[0])
    else:
    for i in range(1):
    self.next_frame()

    def unload(self):
    self.config(image=None)
    self.frames = None

    def next_frame(self):
    if self.frames:
    self.loc += 1
    self.loc %= len(self.frames)
    self.config(image=self.frames[self.loc])
    self.after(self.delay, self.next_frame)

    root = tk.Tk()
    root.geometry('400x200')
    root.title("מערכת הסבת וואלה מייל")
    lbl = ImageLabel(root)
    lbl.pack()
    lbl.load('Logo.gif')


    I ran this code and I don't know how to update the tkinter win after one shows the gif.



    Can someone help me and tell me how to do this? I tried many things and I don't know what to do.










    share|improve this question



























      0












      0








      0








      import tkinter as tk
      import time
      from tkinter import *
      from tkinter import messagebox
      from time import sleep
      from PIL import Image, ImageTk
      from itertools import count
      from time import sleep

      class ImageLabel(tk.Label):

      def load(self, im):
      if isinstance(im, str):
      im = Image.open(im)
      self.loc = 0
      self.frames =

      try:
      for i in count(1):
      self.frames.append(ImageTk.PhotoImage(im.copy()))
      im.seek(i)

      except EOFError:
      pass

      try:
      self.delay = im.info['10']
      except:
      self.delay = 100

      if len(self.frames) == 1:
      self.config(image=self.frames[0])
      else:
      for i in range(1):
      self.next_frame()

      def unload(self):
      self.config(image=None)
      self.frames = None

      def next_frame(self):
      if self.frames:
      self.loc += 1
      self.loc %= len(self.frames)
      self.config(image=self.frames[self.loc])
      self.after(self.delay, self.next_frame)

      root = tk.Tk()
      root.geometry('400x200')
      root.title("מערכת הסבת וואלה מייל")
      lbl = ImageLabel(root)
      lbl.pack()
      lbl.load('Logo.gif')


      I ran this code and I don't know how to update the tkinter win after one shows the gif.



      Can someone help me and tell me how to do this? I tried many things and I don't know what to do.










      share|improve this question
















      import tkinter as tk
      import time
      from tkinter import *
      from tkinter import messagebox
      from time import sleep
      from PIL import Image, ImageTk
      from itertools import count
      from time import sleep

      class ImageLabel(tk.Label):

      def load(self, im):
      if isinstance(im, str):
      im = Image.open(im)
      self.loc = 0
      self.frames =

      try:
      for i in count(1):
      self.frames.append(ImageTk.PhotoImage(im.copy()))
      im.seek(i)

      except EOFError:
      pass

      try:
      self.delay = im.info['10']
      except:
      self.delay = 100

      if len(self.frames) == 1:
      self.config(image=self.frames[0])
      else:
      for i in range(1):
      self.next_frame()

      def unload(self):
      self.config(image=None)
      self.frames = None

      def next_frame(self):
      if self.frames:
      self.loc += 1
      self.loc %= len(self.frames)
      self.config(image=self.frames[self.loc])
      self.after(self.delay, self.next_frame)

      root = tk.Tk()
      root.geometry('400x200')
      root.title("מערכת הסבת וואלה מייל")
      lbl = ImageLabel(root)
      lbl.pack()
      lbl.load('Logo.gif')


      I ran this code and I don't know how to update the tkinter win after one shows the gif.



      Can someone help me and tell me how to do this? I tried many things and I don't know what to do.







      python tkinter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 13:32









      Miraj50

      2,7701924




      2,7701924










      asked Jan 1 at 10:42









      משה אנסבכרמשה אנסבכר

      43




      43
























          1 Answer
          1






          active

          oldest

          votes


















          0














          When I run this program in IDLE it seems to work fine. The thing that IDLE does that is not in the program is running the mainloop. Try adding as the last line in the program:



          root.mainloop()





          share|improve this answer
























          • it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

            – משה אנסבכר
            Jan 1 at 15:21













          • Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

            – figbeam
            Jan 1 at 16:20











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994811%2fupdate-tkinter-window-with-gif%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          When I run this program in IDLE it seems to work fine. The thing that IDLE does that is not in the program is running the mainloop. Try adding as the last line in the program:



          root.mainloop()





          share|improve this answer
























          • it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

            – משה אנסבכר
            Jan 1 at 15:21













          • Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

            – figbeam
            Jan 1 at 16:20
















          0














          When I run this program in IDLE it seems to work fine. The thing that IDLE does that is not in the program is running the mainloop. Try adding as the last line in the program:



          root.mainloop()





          share|improve this answer
























          • it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

            – משה אנסבכר
            Jan 1 at 15:21













          • Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

            – figbeam
            Jan 1 at 16:20














          0












          0








          0







          When I run this program in IDLE it seems to work fine. The thing that IDLE does that is not in the program is running the mainloop. Try adding as the last line in the program:



          root.mainloop()





          share|improve this answer













          When I run this program in IDLE it seems to work fine. The thing that IDLE does that is not in the program is running the mainloop. Try adding as the last line in the program:



          root.mainloop()






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 11:44









          figbeamfigbeam

          3,0851310




          3,0851310













          • it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

            – משה אנסבכר
            Jan 1 at 15:21













          • Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

            – figbeam
            Jan 1 at 16:20



















          • it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

            – משה אנסבכר
            Jan 1 at 15:21













          • Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

            – figbeam
            Jan 1 at 16:20

















          it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

          – משה אנסבכר
          Jan 1 at 15:21







          it's work fine. i ask how after it's run i update the tk win to stop run gif and replace to input row..

          – משה אנסבכר
          Jan 1 at 15:21















          Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

          – figbeam
          Jan 1 at 16:20





          Please start a new question instead of continuing here. This will allow people to see that a new question is asked as this one is already answered.

          – figbeam
          Jan 1 at 16:20




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53994811%2fupdate-tkinter-window-with-gif%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas