So in tkinter I'm making a program, I want to know can you make a title box thing like the one in this image with the title "Booking Details"?
Sounds like you want a Label Frame.
The LabelFrame widget is a variant of the Tkinter Frame widget. By default, it draws a border around its child widgets, and it can also display a title.
Related
I want to make my Entry box without any color and only shows the cursor so it will blend with the canvas image. Here is what I want to make objective design and here is what I am able to make current design.
I did try the root.wm_attributes("-transparentcolor", "yellow") but it will also make the frame invisible. How do I make the entry box transparent without affecting the background. My code is based on the link below.
https://github.com/ajinkyapadwad/Tkinter-HosoKeys
I'm developping a text editor with PyQt5 and I want to create my own "title bar".
I've created my own title bar and I have something just like the image above. The only problem is the window's frame. So far I've been using:
setWindowFlags(Qt.FramelessWindowHint)
But I just realised that with this flag there is no frame (cause it's "Frameless") and without the frame I can't resize my window by dragging the border.
I've tried CustomizeWindowHint flag but the title bar is still there, just without icon, name and buttons.
A temporary solution is to detect whenenver the mouse enter the window by installing eventFilter, get its positions, if it's on the border then we have to change the cursor icon (up, left, down, left-up, left-down,...) and if the user drags then calculate and resize window.
Another solution is to set 8 QSizegrip at every corner of the window but we will have to somehow hide those grips and make sure that they don't take any space because we will add 3 grips at the TOP of the title bar so it will be ugly.
But I don't really like these solutions. So is there anyway that I can hide the title bar and keep the frame?
I was wondering whether it is possible to use some of the tkinter canvas drawing methods on a text widget. Ideally I would have the text widget placed onto the canvas so that I can draw onto the canvas and make it look like it shows up on the text widget.
No, it is not possible to draw over or into a tkinter Text widget. You can, however, add text to a canvas with the create_text method and draw over that.
What the title says.
I'm having a problem moving the textbox from a side to side.
The code's long and it's about 200+ lines so I wont post it here.
Anybody has an idea?
You have various options for this, depending on what you mean by "text box," and whether you want to move it "by pixels" or "from a side to [another] side."
If you just want to display text, you can use a Label widget. If you want a text box where the user can enter text, try an Entry widget. If you want to move your widget from one area of the screen to another, you can use the grid geometry manager and simply use grid_forget to "unplace" your widget then grid (with different options than you originally used, of course) to put it somewhere else.
If you just have text and you'd like to move it pixel by pixel, you could create a Canvas and then use that widget's create_text method to create some text in a specific place on the Canvas. You can the use the Canvas widget's itemconfig method to move the text to a new location.
If you need something more complex than text, like an Entry widget, and you want to move it pixel by pixel, do the same as above but use the create_window method instead.
See Canvas, grid, Label, Entry, and these SO questions about create_window.
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.