Is there a way to place widgets on pixel coordinates rather than row, column coordinates in tkinter?

For example, if I'm using grid, if I have a 20x10 Text box at row 0, column 0 and want to place three buttons to the right of the textbox, one button over the next, the only way I can think of is to put all three buttons at r0, c1, then use pady on the second and third buttons so that they are lined up rather than two buttons being invisible because the third covers it. Putting the second button at r1, c1 would put it lower than the text box, rather than next to it.

Am I missing something? Would it be better to add a frame next to the text box and use row, column or pack in that?

Or should I switch to pyqt4 or some other GUI? My code is in python 3.1, so wxPython wouldn't seem to work.

Yes, instead of using geometry manager pack() or grid(), use place(x, y) for layouts. Note that place(x, y) is absolute, and coordinates x or y can go negative to shift the widget out off the window. One nice trick!

Care should be taken not to mix the different geometry managers!!!

Only potential problem with place() is, that it does not resize with window.

But a solution to that could to use place as much as you like but stop the window from being resized, but it does depend what your program is used for, this might not be useful ... but use

root.overrideredirect(1)

I did that with mine but remember .. have a QUIT button working before you use it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.