Don't show qrcode until geometry is ready.
This commit is contained in:
parent
5e447fb5aa
commit
af7fae6c44
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue