- Timestamp:
- 02/08/23 01:19:53 (22 months ago)
- Location:
- framspy/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/gui/utils.py
r1198 r1202 32 32 self.two = self.init 33 33 34 34 35 #source: https://gist.github.com/walkermatt/2871026 35 36 def debounce(wait): … … 49 50 return debounced 50 51 return decorator 52 53 54 # https://stackoverflow.com/questions/39058038/wm-attributes-and-zoomed-doesnt-work 55 # https://stackoverflow.com/questions/18394597/is-there-a-way-to-create-transparent-windows-with-tkinter 56 def windowHideAndMaximize(wnd): # to get the size of working area on screen (screen minus taskbars, toolbars etc.) - make invisible maximized window 57 wnd.attributes("-alpha", 0) 58 wnd.state('zoomed') 59 wnd.update() 60 61 def windowShowAndSetGeometry(wnd, geometry): 62 wnd.state('normal') 63 wnd.update() 64 wnd.geometry(geometry) 65 wnd.attributes("-alpha", 1) 66 wnd.update() -
framspy/gui/widgets/ConsoleWindow.py
r1198 r1202 2 2 from gui.widgets.ScrolledText import ScrolledText 3 3 from gui.framsutils.FramsSocket import FramsSocket 4 from gui.utils import windowHideAndMaximize, windowShowAndSetGeometry 4 5 from typing import Tuple, Callable 5 6 … … 45 46 return maxwidth, maxheight, x, y 46 47 47 self.attributes("-alpha", 0)48 48 self.update_idletasks() 49 49 50 50 width, height, x, y = parseGeometryString(self.winfo_geometry()) 51 52 self.state('zoomed') 53 self.update() 51 windowHideAndMaximize(self) 54 52 rootx = self.winfo_rootx() 55 56 53 maxWidth, maxHeight, x, y = parseGeometryString(self.winfo_geometry()) 57 58 self.state("normal")59 self.update()60 61 54 x = (maxWidth - width) / 2 62 55 y = (maxHeight - height) / 2 63 64 self.geometry("+%d+%d" % (int(rootx + x), int(y))) 65 self.attributes("-alpha", 1) 66 self.update() 56 windowShowAndSetGeometry(self, "+%d+%d" % (int(rootx + x), int(y))) 67 57 self.maxsize(maxWidth, maxHeight) 68 58 -
framspy/gui/widgets/mainPage.py
r1201 r1202 16 16 from gui.socketInterface import SocketInterface 17 17 from gui.utils import debounce 18 from gui.utils import windowHideAndMaximize, windowShowAndSetGeometry 18 19 from gui.widgets.ToolTip import CreateToolTip 19 20 from time import perf_counter … … 171 172 #ORGANIZE WINDOWS POSITIONS 172 173 ## need to do some workaround to determine screen width and height 173 self.attributes("-alpha", 0) 174 self.state('zoomed') 175 self.update() 174 windowHideAndMaximize(self) 176 175 maxHeight = self.winfo_rooty() + self.winfo_height() 177 176 maxWidth = self.winfo_rootx() + self.winfo_width() 178 177 self.rootx = self.winfo_rootx() 179 self.state("normal") 180 self.update() 181 self.geometry("%dx%d+%d+%d" % (self.OPENGL_WIDTH + self.SIDEBAR_WIDTH, self.OPENGL_HEIGHT, self.rootx, 0)) 182 self.attributes("-alpha", 1) 183 self.update() 178 windowShowAndSetGeometry(self, "%dx%d+%d+%d" % (self.OPENGL_WIDTH + self.SIDEBAR_WIDTH, self.OPENGL_HEIGHT, self.rootx, 0)) 184 179 height = self.winfo_rooty() + self.winfo_height() - self.winfo_y() 185 180 -
framspy/gui/widgets/propertyWindow.py
r1198 r1202 4 4 from typing import Dict, List, Callable, Tuple 5 5 from gui.framsutils.framsProperty import Property, PropertyCallback, propertyToTkinter 6 from gui.framsutils.FramsInterface import FramsInterface, InterfaceType 6 7 from gui.widgets.ToolTip import CreateToolTip 7 from gui. framsutils.FramsInterface import FramsInterface, InterfaceType8 from gui.utils import windowHideAndMaximize, windowShowAndSetGeometry 8 9 9 10 ''' … … 105 106 return maxwidth, maxheight, x, y 106 107 107 self.attributes("-alpha", 0)108 108 self.update_idletasks() 109 109 110 110 width, height, x, y = parseGeometryString(self.winfo_geometry()) 111 111 112 self.state('zoomed') 113 self.update() 112 windowHideAndMaximize(self) 114 113 rootx = self.winfo_rootx() 115 114 116 115 maxWidth, maxHeight, x, y = parseGeometryString(self.winfo_geometry()) 117 118 self.state("normal")119 self.update()120 121 116 x = (maxWidth - width) / 2 122 117 y = (maxHeight - height) / 2 123 118 124 self.geometry("+%d+%d" % (int(rootx + x), int(y))) 125 self.attributes("-alpha", 1) 126 self.update() 119 windowShowAndSetGeometry(self, "+%d+%d" % (int(rootx + x), int(y))) 127 120 self.maxsize(maxWidth, maxHeight) 128 121
Note: See TracChangeset
for help on using the changeset viewer.