Reputation: 3337
When definging your own window, you can set the title when explicitly creating it:
class Main(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="GCT")
Or if using an editor (I'm using glade), you can set the title at time of GUI design, under General settings > Title.
I'm trying to modify the title of the window in code from a loaded builder file, but the title isn't being applied. Instead it shows up with what is generated in the builder file.
self.builder = Gtk.Builder()
self.builder.add_from_file("3x3.glade")
self.builder.connect_signals(self)
self.window = self.builder.get_object("main_window")
self.window.set_title="This is the new title"
self.window.show()
Upvotes: 0
Views: 794
Reputation: 688
This self.window.set_title="This is the new title"
is an assignment.
You're overwriting the variable that is pointing to the function that sets the window title.
Wheres what you really want is self.window.set_title("This is the new title")
- a function call, to set the title to "This is the new title".
:)
Upvotes: 3
Reputation: 65
Here is the line from my builder file (generated by Glade):
<property name="title" translatable="yes">Dq Editor</property>
Here is the code right after reading the builder file:
self.window = self.builder.get_object("window1")
self.window.set_title("Hello")
Using Gtk 3.0 this worked in my program. That is, it changed the title from the builder (glade/xml) file. When the window came up the title was "Hello" which is different from the title in the builder file.
Upvotes: 2