Is it possible to run only a single step of the asyncio event loop

The missing of public method like loop.run_once() is intentional. Not every supported event loop has a method to iterate one step. Often underlying API has methods for creating event loop and running it forever but emulating single step may be very ineffective. If you really need it you may implement single-step iteration easy: import asyncio … Read more

Why do Tkinter’s Radio Buttons all Start Selected When Using StringVar but not IntVar?

In the case of the second set of radiobuttons, they are being rendered in “tri-state mode”. According to the official documentation1: If the variable’s value matches the tristateValue, then the radiobutton is drawn using the tri-state mode. This mode is used to indicate mixed or multiple values. Explanation The default for tristatevalue is the empty … Read more

Tkinter error: Couldn’t recognize data in image file

Your code seems right, this is running for me on Windows 7 (Python 3.6): from tkinter import * root = Tk() canv = Canvas(root, width=80, height=80, bg=’white’) canv.grid(row=2, column=3) img = PhotoImage(file=”bll.jpg”) canv.create_image(20,20, anchor=NW, image=img) mainloop() resulting in this tkinter GUI: with this image as bll.jpg: (imgur converted it to bll.png but this is working … Read more

Tkinter.PhotoImage doesn’t not support png image

PIL is now replaced by Pillow http://pillow.readthedocs.io/en/3.2.x/ solution: from Tkinter import * import PIL.Image import PIL.ImageTk root = Toplevel() im = PIL.Image.open(“photo.png”) photo = PIL.ImageTk.PhotoImage(im) label = Label(root, image=photo) label.image = photo # keep a reference! label.pack() root.mainloop() If PIL could not be found in code, you do need a pillow install: pip install pillow

Tkinter – Geometry management

Basic knowlege about tkinters geometry management The geometry management of tkinter is characterized by this Quote here: By default a top-level window appears on the screen in its natural size, which is the one determined internally by its widgets and geometry managers. Toplevels Your Toplevel is the first question you should have to answer with: … Read more