I currently have a python script which launches a tkinter GUI instance, with a button that once clicked takes a screenshot.
When I run this script under python.exe, the tkinter resolution is fine and the screenshot captures the whole screen. However, when using pythonw.exe, the tkinter window resolution changes (button gets bigger for example) and the screenshot only captures a portion of the screen - the top left hand corner normally.
I need to use pythonw.exe in order to prevent the console window appearing.
Does anyone know why the tkinter window resolution and the screenshot capture is being effected? Presumably the effect on the resolution is why the screenshot capture is being reduced as well.
I am fairly new to Python, so any help with this would be greatly appreciated, below is snippet of the code for the tkinter window and the screenshot functionality. To reiterate this functionality runs completely fine under python.exe.
The screenshot functionality using ImageGrab:
callback1():
ImageGrab.grab_to_file('test.png')
The tkinter window:
master = Tk()
master.wm_attributes("-topmost", 1)
master.title("Report")
master.configure(background='white')
master.iconbitmap(default='icon.ico')
master.resizable(0, 0)
frame1 = Frame(master, bg='white')
frame1.pack(side=BOTTOM, fill=X)
button1 = Button(frame1, compound=BOTTOM, width=307, height=82,
image=photo1, bg='white', command=callback1)
button1.pack(side=TOP, padx=2, pady=8)