V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
explist
V2EX  ›  Python

tkinter 中如何让插入的图片随 root 而改变

  •  1
     
  •   explist · May 7, 2016 · 3742 views
    This topic created in 3643 days ago, the information mentioned may be changed or developed.

    root 窗口可以随意拖拉调整其大小,如何让其内的图片也随之改变?

    代码示例:

    import tkinter as tk 
    
    root = tk.Tk() 
    
    can = tk.Canvas(root,width=950,height=450,bg='white')
    im = tk.PhotoImage(file='test.gif')
    can .create_image(475,225,image=im)
    can.pack(fill='both',expand=1)
    
    root.mainloop()
    
    1 replies    2016-05-11 10:50:46 +08:00
    explist
        1
    explist  
    OP
       May 11, 2016
    消灭零回复
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3672 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 04:38 · PVG 12:38 · LAX 21:38 · JFK 00:38
    ♥ Do have faith in what you're doing.