![]() ![]() It can take any of a number of different forms,ĭepending on the option argument. The winfo command is used to retrieve information about windows Winfo - Return window-related information ?ĭESCRIPTION winfo atom ? -displayof window? name winfo atomname ? -displayof window? id winfo cells window winfo children window winfo class window winfo colormapfull window winfo containing ? -displayof window? rootX rootY winfo depth window winfo exists window winfo fpixels window number winfo geometry window winfo height window winfo id window winfo interps ? -displayof window? winfo ismapped window winfo manager window winfo name window winfo parent window winfo pathname ? -displayof window? id winfo pixels window number winfo pointerx window winfo pointerxy window winfo pointery window winfo reqheight window winfo reqwidth window winfo rgb window color winfo rootx window winfo rooty window winfo screen window winfo screencells window winfo screendepth window winfo screenheight window winfo screenmmheight window winfo screenmmwidth window winfo screenvisual window winfo screenwidth window winfo server window winfo toplevel window winfo viewable window winfo visual window winfo visualid window winfo visualsavailable window ? includeids? winfo vrootheight window winfo vrootwidth window winfo vrootx window winfo vrooty window winfo width window winfo x window winfo y window EXAMPLE KEYWORDS Ideally it would be nice if scrmaxx, scrmaxy = sg.Window.get_screen_size() accepted a mono-spaced "font" parameter to return the (x, y) values in characters instead of pixels, but I guess I could work on doing that myself as well.Tk Built-In Commands - winfo manual page NAME winfo - Return window-related information SYNOPSIS winfo option ? arg arg. Does PySim[pleGUI use the same SetProcessDPIAware() call? I know I can get the maximum pixel sizes of the screen using scrmaxx, scrmaxy = sg.Window.get_screen_size() but those pixel values need to at least be converted to points in order to calculate character maximum values, and perhaps with other factors applied for minimum character and line spacing.Īnother issue that concerns me about your example is whether there might be interference between the SetProcessDPIAware() call in your example and the PySimpleGUI needed setting for DPI awareness. Some research on pixels and points showed me that there is a conversion factor (1.3333) to translate pixels to points and vice versa and even some published tables of pixel values for various font sizes, but I am not sure that the results of that conversion take into account font characteristics like "lineheight" or whether the actual DPI of the attached monitor(s) has any bearing on the conversion calculation. I also may need those maximum values to handle resizing events should they occur. I will have several text widgets populated in the actual application window and want to size them proportionately at window creation time (i.e., in the layouts parameters for size) such that the main window need NOT be maximized. The goal here is to determine the maximum width and height sizes in a particular font and font size so as to be able to size the actual application screen to fit within the available screen real estate BEFORE presenting anything to the end user. That is an interesting way to find out the maximum screen width and height in characters for a given fixed font, but it suffers from needing to present the user with a maximized screen to determine the values. update( value = f'Dimension of window is \n \nin chars') Window( "Title", layout, element_padding =( 0, 0), margins =( 0, 0), SetProcessDPIAware() # Set unit of GUI to pixels sg. Import ctypes import PySimpleGUI as sg def window_dimension( window, monospaced_font):įrom tkinter. ![]() In a curses-based application for a console window one would code something like this: Would return (160, 55) meaning 160 characters of size "Courier 12" across and 55 lines of characters at that font and size. How do I get the width and height of the current screen measured in fixed-width characters at a given point size? Your problem may have already been fixed but is not yet on PyPI.ĭescription of Problem / Question / Details Try again by upgrading your PySimpleGUI.py file to use the current one on GitHub.Searched through Issues (open and closed) to see if already reported.Run your program outside of your debugger (from a command line). ![]() Note that there are also Demo Programs under each port on GitHub.Looked for Demo Programs that are similar to your goal.Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi).Searched through main docs for your problem.Read instructions on how to file an Issue.No - Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)? You have completed these steps: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |