So basically I have a window thats just a vertical list of buttons. I want to create a dropdown menu that goes off to the side without changing the size of the window. I am trying to do this with popover, but now I have the problem where my popover gets cut off by the window. Is there a way I can make it bleed past the window boundaries?
Popovers don't go wider than the parent window. You could have a try at a GtkMenu. They are allowed to go wider than the window, up to the width of the monitor.
Related
I'm writing a file management and config file editing app in Python 3.10 with Dear PyGui as the GUI library. I would like to place a group at the bottom of the window so it:
Stays at the same place when the rest of the content in the window changes
Stays at the same place relative to the lower left (or right) screen corner when the user changes the size of the viewport
I know how to do 1, I can just use pos=(10, dpg.get_viewport_height()-75).
I don't know how to do 2. The above seems to do it upon launch and if you don't resize the viewport, but it doesn't actually anchor them to that relative spot as the window size changes:
To anchor the group to the bottom, you need to update its position on the window resize. Dear PyGui has a callback that fires every time the window is resized: dpg.set_viewport_resize_callback(update) where update is a function that, in this case, runs dpg.set_item_pos("bottom_buttons", (10, dpg.get_viewport_height()-75)). This will keep the buttons positioned at the bottom of the screen.
There might be a better way to do this, and doing it this way might have consequences for overlapping content later on, but it's the easiest way to implement it that I have tried.
CleanMyMacX image
As you can see, some of the buttons are outside of the window, and the window's title isn't visible. I am wondering if this is possible to do in python tkinter, and if so, how to do it.
Thanks!
I have a Gtk window that I fill with different grids. I notice that my code is starting to become a huge mess!
Basically I have 1 window with buttons. On button click, I want the Gtk Window to display a different grid. But the more screens I get, the messier my code gets.
What is the best way to do this?
I have a python program which has a button to popup a Toplevel windows in the center.
I can use Toplevel.resizable(0, 0) to limit the size of window, but i want to limit the position of windows and can't move the window by mouse.
How can i do this?
You can use Toplevel.overrideredirect(True) to make the Window Manager ignore this window. This removes the title bar and borders, thus preventing the user from moving it, but this also removes it from the taskbar.
I've been playing with this cookbook example to make a scrollable matplotlib plot with wxPython. However, when I run this code on my Windows 7 machine at work, the scrollbar doesn't seem to work properly. In particular, if I click and drag it to a position, it does update the plot, but then the scrollbar moves back its starting position, instead of staying put. I'm curious if anyone has an idea what's going on here. FWIW, this code worked fine when I ran it on my Linux Mint 14 machine at home.
Right now, I'm trying to fix it by using a wx.ScrolledWindow or a wx.lib.scrolledpanel instead of adding the scrollbar directly to the canvas as in the example. I was also considering using a slider instead of a scrollbar
Thanks
From Programing Windows, Fifth Edition (emphasis mine)...
When you use scroll bars within your program, you share responsibility
with Windows for maintaining the scroll bars and updating the position
of the scroll bar thumb. These are Windows' responsibilities for
scroll bars:
Handle all processing of mouse messages to the scroll bar.
Provide a reverse-video "flash" when the user clicks the scroll bar.
Move the thumb as the user drags the thumb within the scroll bar.
Send scroll bar messages to the window procedure of the window containing the scroll bar.
These are the responsibilities of your program:
Initialize the range and position of the scroll bar.
Process the scroll bar messages to the window procedure.
Update the position of the scroll bar thumb.
Change the contents of the client area in response to a change in the scroll bar.
...so somewhere in OnScrollEvt() method, you'll need call SetScrollPos() with something like...
self.canvas.SetScrollPos(wx.HORIZONTAL, event.GetPosition(), True)