0

After watching the video i am inspired to create one browser but stuck at one place, could you please help me with this.

Requirement = - Like you displayed in your Video i wan create Multiple Buttons in my Toolbar which will open Second ToolBar or Popup Window. - From that Pop Window i wanted to Select Specific Button Which will open My Required Browser.

Question - - As displayed in your Video i create new BUtton and If i try to open new link using that it works but now i want to display tool bar or Popup window once any one click on that button, how can i do that.The Second Tool Bar Need to be Activated only after clicking on that button.

Things i Tried - - As per my understanding i create Second Toolbar and on that tool bar i have created Button, now i wan know how do i link that tool bar with my Browser Toolbar button. - I tried that by passing Signal Property in Second Toolbar in Quickly but something is missing.

  • MY Code

    class TvbrowserWindow(Window):
        __gtype_name__ = "TvbrowserWindow"
    
        def finish_initializing(self, builder): # pylint: disable=E1002
            """Set up the main window"""
            super(TvbrowserWindow, self).finish_initializing(builder)
    
            self.AboutDialog = AboutTvbrowserDialog
            self.PreferencesDialog = PreferencesTvbrowserDialog
    
            # Code for other initialization actions should be added here.
            self.refreshbutton=self.builder.get_object("refreshbutton")
            self.SONY=self.builder.get_object("SONY")
            self.urlentry=self.builder.get_object("urlentry")
            self.scrolledwindow1=self.builder.get_object("scrolledwindow1")
            self.webview = WebKit.WebView()
            self.scrolledwindow1.add(self.webview)
            self.webview.show()
        def on_refreshbutton_clicked(self, widget):
            print "refresh"
        def on_urlentry_activate(self, widget):
            url = widget.get_text()
            print url
            self.webview.open(url)
    

1 Answer 1

0

To make a tool bar visible after clicking a button you should call the toolbar's show method after the button is clicked:

self.toolbar = self.builder.get_object("nameOfToolbar")
self.toolbar.show()

Also make sure under common settings for toolbar in glade are set "No show all" is set to yes, and "Visible" is set to no.

3
  • Thanks Sam!! I tried this but didn't worked.... self.SONY=self.builder.get_object("SONY") self.scrolledwindow1=self.builder.get_object("scrolledwindow1") self.webview = WebKit.WebView() self.scrolledwindow1.add(self.webview) self.toolbar = self.builder.get_object("toolbar2") self.webview.show() def on_refreshbutton_clicked(self, widget): print "refresh" def on_urlentry_activate(self, widget): url = widget.get_text() print url self.webview.open(url) def on_SONY_clicked(self, widget): self.toolbar.show()
    – Akshay
    Commented Jun 26, 2012 at 2:09
  • What did it do? Did you remember to set "No show all" to yes and "Visible" to no? Commented Jun 26, 2012 at 3:13
  • Yes i did set those value. My Code going in to that button action but doesn't perform those 2 lines.
    – Akshay
    Commented Jun 27, 2012 at 1:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .