Enabling/disabling fullscreen and maximize window with a keypress in Python 3.x -


i need enable/disable fullscreen , maximized window (--zoomed) in python 3.x using tkinter. code

from tkinter import * tk = tk()  def fullscreen_on(event):   tk.attributes(--fullscreen, true), repr.event.f11  def fullscreen_off(event):  tk.attributes(--fullscreen, false), repr.event.escape   photo = photoimage(file="image.gif") image_label=label(tk, image=photo) image_label.grid(row=0, column=2)   tk.mainloop() 

it shows image, can't zoom/enable fullscreen.

you defining callbacks not binding them in application. callback react needs bound event (e.g. tk.bind ("<key>", callback) )

please have on documentation of event / event-binding.

you can bind event shown in question.

what want using repr.event.f11 / repr.event.escape? print something?

please make sure fix indentation.

you can bind f11 , escape callbacks using

  • tk.bind("<f11>", fullscreen_on)
  • tk.bind("<escape>", fullscreen_off)

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -