How to stick the menubar at the top of the window PyGTK - pygtk

How can i stick the menubar at the top of the window?
I'm using a Gtk.VBox and i added Gtk.MenuBar inside. I'm using Gtk3
The code source : http://pastebin.com/YHZQLzZg
Thanks

If you mean by this that you want no titlebar ( just a menubar ), then you can try the Gtk set_decorated() function using False as a parameter. On some systems that will allow a window with no titlebar ( and possibly other things that are standard ) to be created. But it's not guaranteed to work as it is dependant on the window manager, not Gtk or Python.
Gtk set_decorated function

The issue was using
window.set_border_width(10)
i removed the border width and everything works fine.

Related

Set focus to child window in PyGtk

I am writing a simple application in python using PyGObject and glade. The application has a main window and a functional window (Generate logs, also a Window object) which opens up on clicking a menu item.
The Generate logs window is supposed to:
Show options to generate log for a particular date
Be minimizable and should close automatically when the task is complete (OR)
Be able to be closed manually if the user wishes so
The problem is, once I show up the Generate logs window, I am directly able to select the main window as well. Then, I can go to the menu and bring up as many Generate logs windows as I want.
I have tried several options (Is Focus, setting up main window as Transient parent etc) but nothing worked. How can I fix this?
First you say PyGTK, then you say PyGObject, this are 2 different things. I'm going to answer for PyGTK (my sources are from GTK+ 2 docs) since it's in the title and maybe people looking for that will end up here. But never fear, because for this question, the answer is practically (I think exactly) the same for both.
What I understand is that you want you "Generate log" window to be modal. That means other windows can't be used while your modal window is up, just like a Dialog window. Also you should set the main window to be the parent of your modal window, since this helps the OS Window Manager i.e. keep the dialog on top of the main window.
Yo can do both of this things directly from Glade (if you've created both windows in the same project, not always the case) selecting the Modal atribute to True and the Transient for Window attribute to your main window, in the General Properties section of your Generate log window.
Also you can do it programmatically using the set_modal() and the set_transient_for(parent_window) method of your child window.
Let's say your parent window is called main_window and the child window is generate_log_window, then you can do it like this:
generate_log_window.set_modal(gtk.TRUE)
generate_log_window.set_transient_for(main_window)
If you want it to show center top of your main window, do this
generate_log_window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
To your second point, the ability to minimize can be set from Glade.
Sources:
GTK+ 2 GtkWindow reference set_modal
GTK+ 2 GtkWindow reference set_transient_for
PyGTK FAQ: How do I get my windows to show up where I want
PyGTK FAQ: How do I make a dialog block the whole application, so the user is forced to answer it?
create several windows (see your other post).
Upload them in init
Show them with "signals" in glade using "show" and "hide"
class GUIxxxx
#...
def action1(self, widget, data=None):
self.window1.show()
def action2(self, widget, data=None):
# do something here
self.window1.hide()

Remove HeaderBar gtk3 vala

I have such a question, can I remove 'HeaderBar'? I want to use WebKit and make my own controllers.
Perhaps it can be done like that via CssProvider?
Screen
Solution - window.set_decorated(false);
What you are trying to 'remove' its not the 'HeaderBar', its the window decoration. Gtk.HeaderBar its a different thing. Window decoration is dependable of the window manager as stated in the documentation:
By default, windows are decorated with a title bar, resize controls,
etc.
Some window managers allow GTK+ to disable these decorations, creating
a borderless window. If you set the decorated property to false using
this function, GTK+ will do its best to convince the window manager
not to decorate the window. Depending on the system, this function may
not have any effect when called on a window that is already visible,
so you should call it before calling show.
On Windows, this function always works, since there’s no window
manager policy involved.
Although you got the right method to disable the window decoration (Gtk.Window set_decorated(bool)) these clarifications are needed.

how to keep processing output window always on top

I am currently making a project on kinect using SimpleOpenNI and Processing and am new to it.
I want to know how I can keep my output window always on top...even when i switch focus to some other application like powerpoint or vlc??
Try frame.setAlwaysOnTop(true);. It's from the Window Class, but processing's frame variable is an AWT Frame, which extends Window.
Documentation

how to make a windows forms app unresizable?

how to make the windows app in vs 2008 unresizable?because when you launch the application and point and drag to its corners, the window grows.
Change the FormBorderStyle to a fixed one, depends what look you want. Here's a full list of options, you probably want Fixed3D or FixedSingle
You also probably want to set MaximizeBox to false.
Both of these can be found in the designer as options on the form, or set in code, whichever you prefer.
Take a look on the properties of the window control in the properties window. You'll probably figure out how to do this + how to control few more staff about the window..
Change the ResizeMode property of the window.

Gorm main window does not accept drag-and-drop

When I try to add any widget (label, button ...) to main application Window in Gorm, the Window does not accept the widget. I try to drag and drop but nothing wants to 'stick'. When I select and left click on button widget in palette window the curson changes to '2 green squares'. When I start dragging it changes to '2 black squares'.
Another problem is that the 'Document' window opens really long window (stretches about 5 times the width of my screen) but apart from NSOwner, NSFirst, My Window and NSMenu icons it is empty.
Any ideas what is wrong?
I'm running linux with fluxbox-1.1.1
I've compiled gorm-1.2.8 and gnustep-startup-0.22.0 that contains:
ffcall-1.10
gnustep-back-0.16.0
gnustep-base-1.18.0
gnustep-gui-0.16.0
gnustep-make-2.0.7
gnustep-objc-1.6.0
libffi-3.0.1
Any help is appreciated.
Thanks
Maybe there's a compatibility issue or some conflict between existing run time libraries and the new ones that I'm trying to add. Doesn't seems like there's a straightforward answer for this. Nevermind, I gave up trying atm. Maybe later when I setup another Linux box I give it a try - I'll stay with Mac OS X for now :)