I am using a python 2.5 + pygtk.
I have added a text area in a scrolled window. Text area buffer will be updates with program output.
I want to set scrolledwindow->vscrollbar at the bottom.
I tried different options given in pygtk docs. But no success..
Any suggestion what needs to do???
You have to fetch the vertical adjustment of your scrolled window, then set its value to its upper bound:
adjustment = yourScrolledWindow.get_vadjustment()
adjustment.set_value(adjustment.get_upper())
Related
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?
After lots of reading, I could not find solution for my problem.
I have made a quiz program using Tkinter and Python. I also used pack geometry manager everywhere. Window is not resizable, it's set to 960x540, and all widgets are precisely set in window using X and Y coordinates. Now, I'd like to make full screen option. But, when I turn it full screen, all widgets are moved in upper left corner (because they are set to X and Y coordinates using place manager). Any idea how could widgets 'stretch' when I turn window into full screen?
I know this could be accomplished using grid managed, but I would like to use pack manager instead.
I didn't post any code, because I don't think it would help. Please correct me if I'm wrong!
PS: Sorry for my weird English, and thank you a lot!
If you don't want to use grid you're going to need to use the place manager. A lot of people recommend against it because it's more complex, but I like the control it gives you over your GUI.
For example you can have a label that always stays in a relative position and has a relative width and height (in relation to the size of the screen)
newLabel = tk.Label(root)
newLabel.place(relwidth = 0.5, relheight = 0.2, relx = 0.25, rely = 0.4)
This creates a label that is always half the width of the root size, 20% of the root height, and is always centered in the screen.
These are two excellent tutorials on pack and place, and more importantly they are a great reference for the options that pack and place offer (scroll to the bottom of the page to see all the options and their descriptions). You may be able to get pack to do what you want, but I stick with place.
http://effbot.org/tkinterbook/pack.htm
http://effbot.org/tkinterbook/place.htm
I have followed the tutorial here: Transparent Frames
How can I make it so only the text from TextCtrl has 100% opacity while the rest of the window is invisible? What i mean is, I want an invisible window except for the text in TextCtrl.
I am on Windows 7, using python 2.7.
According to the tutorial you linked:
Only top-level controls can be transparent; no other controls can
A textctrl or statictxt, of course, is not a top level control.
There is this option, which I believe only works ontop of other opaque objects not on a transparent panel.
This shows how to draw an arbitrarily shaped window. If you combine (somehow) the above two, you should be able to get text against a transparent background. Other than that, good luck.
I have a vbox in main window. Within the vbox is a menu and a fix. The fix is used to load image. I should change the size of main window according to the size of image. But I cannot find a way to get the size of menu bar. So the bottom part of the image cannot be displayed(I set the window unresizable).
I don't explicitly set the size of the menu. So it seems that all the functions ending with 'request' return -1.
How can I get the actual size of the menu bar? Or how can I display the image entirely?
In mac, created a unified mac toolbar with the title bar.
Also set toolbutton style to textundericon. But Found a gap between toolbar button and titlebar border when the toolbar button is checked or pressed.
Hope someone have a trick to reduce the gap to zero.
Attached the screenshot of the window
Thanks
Even after resizing the toolbutton added to the toolbar, the space between the toolbar border and the tool button is not get reduced. Any clue?
I've never developed specifically for the Mac using Qt, but I usually call QWidget::setContentsMargins(int left, int top, int right, int bottom) and set the appropriate parameter to zero. In this case you may try calling setContentsMargins(x,x,x,0) for the QToolBar and see what that gets you, where x are values you pick. IIRC, I think 11 is the default margin spacing for a QWidget but it may be different (and from the screenshot, does look different) for QToolBar, you can experiment a little and see if you get the look that you're trying to achieve.
I've also used a similar approach to tweak the spacing in QLayout subclasses with success.