#! /usr/bin/python3 # =================================================================== # # =================================================================== import numpy as np import draw_xy_axes as ax import user_interface as ui import coordinate_conversion as cc from graphics import * win_width = 800 win_height = 400 # ------------------------------------------------------------------- # ---- test/verify round function # when used with window size # ------------------------------------------------------------------- def test_round(winx,winy): midx = winx/2 midy = winy/2 rmidx = round(winx/2) rmidy = round(winy/2) print() print(f'winx/2 = {midx} {type(midx)}') print(f'winy/2 = {midy} {type(midy)}') print(f'round(winx/2) = {rmidx} {type(rmidx)}') print(f'round(winy/2) = {rmidy} {type(rmidy)}') print() # ------------------------------------------------------------------- # ---- main # ------------------------------------------------------------------- win = GraphWin("Window Coordinatesi test",win_width, win_height) win.setBackground("white") print() print(f'Window Width = {win.width} {type(win.width)}') print(f'Window Height = {win.height} {type(win.height)}') ##win.plotPixel(0, 0, "red") test_round(800,400) test_round(801,401) ui.pause() win.close()