0
xのオフセットが220ピクセル、yのオフセットが120ピクセルの幅1500ピクセルx高さ900ピクセルのウィンドウを作成します。作成直後にウィンドウの幅と高さにアクセスしようとしましたが、実際のウィンドウに対応していない値が表示されます。tkinterとpython 3.6.0を使用して作成されたウィンドウの実際のジオメトリ属性を取得するにはどうすればよいですか?
これは印刷された出力です。
Right after Creation
size_string 1500x900+220+120
current geometry 1x1+220+120
root_width, root_reqwidth 1 200
root_height, root_reqheight 1 200
winfo_x, winfo_y 0 0
これはコードです。
from tkinter import *
def callback():
print ("Not Yet Defined")
root = Tk()
root.title("Manage My Money")
# This segment sets the size of the window and the offsets
win_height_pixels=900
win_width_pixels=1500
win_x_offset_pixels=220
win_y_offset_pixels=120
size_string=str(win_width_pixels)+"x"+str(win_height_pixels)+"+"+str(win_x_offset_pixels)+"+"+str(win_y_offset_pixels)
root.geometry(size_string)
# This prints out the attributes of the window
print("Right after Creation")
print ("size_string",size_string)
current_geom=root.geometry()
print ("current geometry", current_geom)
root_width=root.winfo_width()
root_reqwidth=root.winfo_reqwidth()
print ("root_width, root_reqwidth", root_width, root_reqwidth)
root_height=root.winfo_height()
root_reqheight=root.winfo_reqheight()
print ("root_height, root_reqheight", root_height, root_reqheight)
winfo_x=root.winfo_x()
winfo_y=root.winfo_y()
print("winfo_x, winfo_y", winfo_x, winfo_y)
「対応していない値」とはどういう意味ですか? – eventHandler