Код на джаве:
// a) sets the window height to 200 pixels
window.innerHeight = 200;
// b) will increase the height of the window by 200 pixels
window.innerHeight += 200;
// c) will reduce the width of the window by 100 pixels
window.innerWidth -= 100;
// d) set the window offset from the left border of the screen to 100 pixels
window.screenX = 100;
// e) move the window 100 pixels to the right
window.screenX += 100;
// f) move the window 100 pixels to the left
window.screenX -= 100;
// g) will move the window 200 pixels up
window.screenY -= 200;
// h) will move the window 100 pixels down
window.screenY += 100;
На питоне:
import tkinter as tk
root = tk.Tk()
# a) sets the window height to 200 pixels
root.geometry("300x200")
# b) will increase the height of the window by 200 pixels
root.geometry("300x400")
# c) will reduce the width of the window by 100 pixels
root.geometry("200x400")
# d) set the window offset from the left border of the screen to 100 pixels
root.geometry("+100+0")
# e) move the window 100 pixels to the right
root.geometry("+200+0")
# f) move the window 100 pixels to the left
# g) will move the window 200 pixels up
root.geometry("+100-200")
# h) will move the window 100 pixels down
root.geometry("+100+100")
root.mainloop()
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Код на джаве:
// a) sets the window height to 200 pixels
window.innerHeight = 200;
// b) will increase the height of the window by 200 pixels
window.innerHeight += 200;
// c) will reduce the width of the window by 100 pixels
window.innerWidth -= 100;
// d) set the window offset from the left border of the screen to 100 pixels
window.screenX = 100;
// e) move the window 100 pixels to the right
window.screenX += 100;
// f) move the window 100 pixels to the left
window.screenX -= 100;
// g) will move the window 200 pixels up
window.screenY -= 200;
// h) will move the window 100 pixels down
window.screenY += 100;
На питоне:
import tkinter as tk
root = tk.Tk()
# a) sets the window height to 200 pixels
root.geometry("300x200")
# b) will increase the height of the window by 200 pixels
root.geometry("300x400")
# c) will reduce the width of the window by 100 pixels
root.geometry("200x400")
# d) set the window offset from the left border of the screen to 100 pixels
root.geometry("+100+0")
# e) move the window 100 pixels to the right
root.geometry("+200+0")
# f) move the window 100 pixels to the left
root.geometry("+100+0")
# g) will move the window 200 pixels up
root.geometry("+100-200")
# h) will move the window 100 pixels down
root.geometry("+100+100")
root.mainloop()