Moving elements between Tkinter Treeview widgets - python

I am trying to implement a function that lets me drag and drop treeview entries between N treeview widgets. I played around with detach/insert as well as move. While I got drag and drop reordering within widgets running, I cannot figure out how to drop them into another.

Related

Create and align non-rectangular widgets together with PyQt6

I need to create a widget/layout, which will contain a number of non-rectangular, clickable widgets that are well aligned together so that they create a whole (picture below).
Each of theses widgets needs to be clickable and have a hover option. I thought of using QAbstractButton or QPushButton class and overriding it's paintEvent to draw it with a particular size and shape, but I don't know if this is a optimal solution. I also have no idea how I could then align these widgets together so that there are no empty spaces between them. I thought of using some absolute position of a parent Window and manually adjust child widgets position based on that.

PyGTK/Glade keep button size standard

I have a simple pygtk/glade window with a menu and a 3x3 grid. Each row of the grid consists on: two labels and a button.
When the Window is resized, the labels holds the same font size, but the buttons get resized, and they could become HUGE if the windows gets very big.
How could I manage to keep my buttons with the same size always (the "standar" size of a button, just like they are when the interface is just opened) no matter if the Window is resized?
You just have to set the fill and expand parameters of the Buttons to False (uncheck them in the Glade interface).
You would also want to put each button at the center of a 3x3 GtkTable, so it will appear centered and not aligned at the top of the cell

Pygtk: CellRenderer using up all vertical space

I made a user interface with a ComboBox. I'm using glade so I'm doing the following at runtime
combo_box.set_model(liststore)
cell = gtk.CellRendererText()
combo_box.pack_start(cell,False)
combo_box.add_attribute(cell,'text',0)
And when I click on the ComboBox the cellrenderer takes up all the vertical space of the screen. However, if I limit the number of items in the liststore, and the cellrenderer does not need a to scroll, the problem disappears.
Here's a picture of the problem:
What is happening?
Thank you for your time.
From what I know this is in GTK+ by design (though I have no references, and could equally be completely wrong). The idea is that when you have a list of items in a ComboBox or Menu, which forces the list off the screen. GTK+ makes a decision to place the first item both at the top of the list, and beneath you mouse cursor.
This means that you have the scrolling effect to reach items at the bottom, which GTK+ indicates by creating scrollable whitespace.
The easiest way around this is to structure the items into submenus, but this again could fall over on a small-sized screen.

Python Tkinter - Scrollable canvas containing expandable widgets

I'm using Python Tkinter and I want to place a variable number of text box widgets in a frame or canvas. The text boxes are packed vertically down the frame, so the first one is on top, the second one is found below, etc.. I can have all the button, listbox, etc widgets in a "left section" of the GUI, while a "right section" will only contain the text box widgets. I want the text box widgets to horizontally expand when the master window is maximized, but because there's a variable number of these widgets, the "right section" containing the text boxes also needs to be able to vertically scroll to view them all.
Currently, I'm using Canvas.create_window to add my variable number of text boxes to the canvas, and while I can scroll the canvas to view all the text boxes, they do not horizontally expand when I resize the window. I have an alternate GUI that uses a frame for the "right section", which allows the widgets to horizontally expand, but if too many are packed, I cannot scroll the frame to see the additional text boxes because I can't have a scroll bar tied to a frame.
Is there any way around this trade-off?
The solution is pretty simple: bind to the <Configure> event of the canvas -- this will cause your callback to be called whenever the canvas widget is resized. You then simply need to get the width of the canvas and use that to iteratively resize all the embedded windows.

Set the size of wx.GridBagSizer dynamically

I'm creating an app where I drag button widgets into a panel. I would like to have a visible grid in the panel where i drop the widgets so the widgets will be aligned to the grid.
I guess it isn't hard making a grid where the squares are 15x15 pixels using a GridBagSizer(since the widgets will span between multiple cells), but how can the number of squares be made dynamically according to the size of the panel?
Do I have to calculate how many squares i need to fill the panel on init and on each resize?
Using python and wxpython btw.
Oerjan Pettersen
Don't use a sizer at all for this. Just position the buttons yourself, with whatever co-ordinate rounding you like. (using wxWindow::SetSize()).
(The point of a sizer is that the buttons will get moved and/or resized when the window is resized. As you don't want that behaviour, then you shouldn't use a sizer.)

Categories