Don't show qrcode until geometry is ready.

This commit is contained in:
voussoir 2021-09-13 21:04:33 -07:00
parent 5e447fb5aa
commit af7fae6c44
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -24,6 +24,7 @@ def showqr_argparse(args):
image = qrcode.make(text).get_image() image = qrcode.make(text).get_image()
root = tkinter.Tk() root = tkinter.Tk()
root.withdraw()
root.title("QR code") root.title("QR code")
root.bind('<Escape>', lambda *args, **kwargs: root.quit()) root.bind('<Escape>', lambda *args, **kwargs: root.quit())
root.bind('<Control-s>', lambda *args, **kwargs: save_image(root, image)) root.bind('<Control-s>', lambda *args, **kwargs: save_image(root, image))
@ -38,6 +39,7 @@ def showqr_argparse(args):
y_offset = (root.winfo_screenheight() - height) / 2 y_offset = (root.winfo_screenheight() - height) / 2
root.geometry('%dx%d+%d+%d' % (width, height, x_offset, y_offset-50)) root.geometry('%dx%d+%d+%d' % (width, height, x_offset, y_offset-50))
root.deiconify()
root.mainloop() root.mainloop()
return 0 return 0