Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77327

Re: Sequencing images using tkinter?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'canvas': 0.07; 'sys': 0.07; 'tkinter': 0.07; 'canvas.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'python': 0.11; 'jan': 0.12; 'random': 0.14; 'illustrate': 0.16; 'master.': 0.16; 'pause': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'simplified': 0.16; 'tk()': 0.16; 'wrote:': 0.18; 'skip:p 40': 0.19; 'typing': 0.19; 'unlike': 0.19; 'widget': 0.19; 'thanks.': 0.20; '(the': 0.22; 'import': 0.22; 'header:User- Agent:1': 0.23; 'please?': 0.24; "i've": 0.25; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; "doesn't": 0.30; 'needed.': 0.30; 'apparently': 0.31; 'anyone': 0.31; 'skip:m 30': 0.32; "can't": 0.35; 'display': 0.35; 'problem.': 0.35; 'but': 0.35; 'version': 0.36; 'really': 0.36; 'idle': 0.36; 'keyword': 0.36; 'subject:?': 0.36; 'displays': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tips': 0.61; 'email addr:gmail.com': 0.63; 'spot': 0.65; 'here': 0.66; '3.4': 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Sequencing images using tkinter?
Date Sat, 30 Aug 2014 15:52:07 -0400
References <dcff98af-47cd-4dbc-9fa1-02dc6813df81@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-71-175-90-87.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <dcff98af-47cd-4dbc-9fa1-02dc6813df81@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13649.1409428360.18130.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409428360 news.xs4all.nl 2967 [2001:888:2000:d::a6]:41542
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77327

Show key headers only | View raw


On 8/30/2014 11:54 AM, theteacher.info@gmail.com wrote:
> I've started to learn to use tkinter but can't seem to rotate images.
>
> Here is a Python 3.4 program to illustrate the problem.
 > Anyone spot why the for loop doesn't seem to want to display
 > a sucssession of images please? Thanks.
>
> import sys
> from tkinter import *
> import random
> from time import sleep
>
> myGui = Tk()
> myGui.geometry("1000x800+400+100")
> myGui.title("The Random Machine")
>
> monsters = ["py01.gif", "py02.gif", "py03.gif", "py04.gif", "py05.gif", "py06.gif", "py07.gif", "py08.gif",
>              "py09.gif", "py10.gif", "py11.gif", "py12.gif", "py13.gif", "py14.gif", "py15.gif", "py16.gif",
>              "py17.gif", "py18.gif", "py19.gif", "py20.gif",]
>
>
> #Main canvas
> canvas1 = Canvas(myGui, width=1000, height=800, bg="white")
> canvas1.place(x=0,y=0)
>
>
> #button
> myButton1=Button(canvas1, text='OK', justify = LEFT)
>
> for i in range(10):
>     myImage = PhotoImage(file="MonsterImages/Converted/" + random.choice(monsters))
>     myButton1.config(image=myImage, width="100", height="200")
>     myButton1.place(x=500,y=300)
>     sleep(0.2)
>
> myGui.mainloop()

I tried a simplified version of this in the Idle shell. Idle displays 
call tips if you pause after typing '('.  Unlike .pack and .grid, .place 
apparently does not automatically put the widget in its master. At least 
this is true when placing in a canvas. You need an 'in_' argument (the 
'_' is needed to not be the keyword 'in').  Try

canvas1.pack() #don't use place unless really needed.
...
myButton1.place(in_=canvas1, x=500, y=300)

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sequencing images using tkinter? theteacher.info@gmail.com - 2014-08-30 08:54 -0700
  Re: Sequencing images using tkinter? Terry Reedy <tjreedy@udel.edu> - 2014-08-30 15:52 -0400
  Re: Sequencing images using tkinter? Peter Otten <__peter__@web.de> - 2014-08-30 21:54 +0200
  Re: Sequencing images using tkinter? theteacher.info@gmail.com - 2014-08-30 13:11 -0700
  Re: Sequencing images using tkinter? theteacher.info@gmail.com - 2014-08-30 13:27 -0700
    Re: Sequencing images using tkinter? "Albert Visser" <albert.visser@gmail.com> - 2014-08-30 22:49 +0200
  Re: Sequencing images using tkinter? theteacher.info@gmail.com - 2014-08-30 13:37 -0700
    Re: Sequencing images using tkinter? Peter Otten <__peter__@web.de> - 2014-08-30 23:14 +0200
      Re: Sequencing images using tkinter? theteacher.info@gmail.com - 2014-08-31 02:51 -0700

csiph-web