2022年11月16日 星期三

Python GUI EX1.5 , 1.6

 # ch1_5.py

from tkinter import *


root = Tk()

w = 300     # 視窗寬

h = 160     # 視窗高

x = 400     # 視窗左上角x軸位置

y = 200     # 視窗左上角Y軸位置

root.geometry("%dx%d+%d+%d" % (w,h,x,y))

root.mainloop()




# ch1_6.py

from tkinter import *


root = Tk()

screenWidth = root.winfo_screenwidth()      # 螢幕寬度

screenHeight = root.winfo_screenheight()    # 螢幕高度

w = 300                                     # 視窗寬

h = 160                                     # 視窗高

x = (screenWidth - w) / 2                   # 視窗左上角x軸位置

y = (screenHeight - h ) / 2                 # 視窗左上角Y軸位置

root.geometry("%dx%d+%d+%d" % (w,h,x,y))

root.mainloop()





沒有留言:

張貼留言

ESP32-Flutter-MQTT-IoT-Controller

 ESP32-Flutter-MQTT-IoT-Controller 這套系統包含了 Flutter 跨平台 App 、 ESP32 韌體 與 MQTT 雲端傳輸機制 。 專案中採用的 功能命名原則與對應關係 整理如下: 1. 核心功能名稱對照表 功能區塊 Python / ...