- Posts: 399
- Thank you received: 133
Help with python scrolledwindow
7 years 3 months ago - 7 years 3 months ago #139315
by persei8
Help with python scrolledwindow was created by persei8
I'm hoping a python expert can help me out here. First, what I am trying to do is display a HTML file in a notebook tab in my gscreen handler file. This tab contains a gtk scrolledwindow. I made a test program that works, shown below:
#!/usr/bin/env python
import webkit, gtk
win = gtk.Window()
win.set_position(gtk.WIN_POS_CENTER_ALWAYS)
win.resize(800,600)
win.connect('destroy', lambda w: gtk.main_quit())
win.set_title('WTF')
scrolled_window = gtk.ScrolledWindow()
browser = webkit.WebView()
browser.open("file:///home/jim/linuxcnc/configs/silverdragon/GCodes.html")
scrolled_window.add_with_viewport(browser)
win.add(scrolled_window)
win.show_all()
gtk.main()
If I replace:
scrolled_window.add_with_viewport(browser)
with:
self.widgets.scrolledwindow1.add_with_viewport(self.browser)
(browser became self.browser because the handler file defines classes that the test program does not have.)
in my handler file, it does not work. It just shows a blank tab. So I guess the question is - Can a widget created by python be added to a widget created by Glade? Thanks for any help.
#!/usr/bin/env python
import webkit, gtk
win = gtk.Window()
win.set_position(gtk.WIN_POS_CENTER_ALWAYS)
win.resize(800,600)
win.connect('destroy', lambda w: gtk.main_quit())
win.set_title('WTF')
scrolled_window = gtk.ScrolledWindow()
browser = webkit.WebView()
browser.open("file:///home/jim/linuxcnc/configs/silverdragon/GCodes.html")
scrolled_window.add_with_viewport(browser)
win.add(scrolled_window)
win.show_all()
gtk.main()
If I replace:
scrolled_window.add_with_viewport(browser)
with:
self.widgets.scrolledwindow1.add_with_viewport(self.browser)
(browser became self.browser because the handler file defines classes that the test program does not have.)
in my handler file, it does not work. It just shows a blank tab. So I guess the question is - Can a widget created by python be added to a widget created by Glade? Thanks for any help.
Last edit: 7 years 3 months ago by persei8. Reason: Added a file
Please Log in or Create an account to join the conversation.
7 years 3 months ago #139321
by cmorley
Replied by cmorley on topic Help with python scrolledwindow
It is indeed possible to add python created widgets to GLADE created widgets.
Did you add self.browser.show() anywhere?
could you post your handler file?
Chris
Did you add self.browser.show() anywhere?
could you post your handler file?
Chris
Please Log in or Create an account to join the conversation.
7 years 3 months ago #139328
by persei8
Replied by persei8 on topic Help with python scrolledwindow
"Did you add self.browser.show() anywhere?"
Sonofa *****, that's all it takes?
I assumed that init_show_windows() would take care of that, but obviously not.
It now shows the HTML file in a notebook tab. Now I just need to figure out how to disable clicking of links because that causes a X Window System Error. I guess I should be careful what I wish for.
Anyway, I was also going to ask if you are interested in an updated silverdragon? I made several updates which actually improve the usability. I would leave out the HTML business because the user would then have to find and install python webkit which was in itself an ordeal. Thanks for the reply.
Sonofa *****, that's all it takes?
I assumed that init_show_windows() would take care of that, but obviously not.
It now shows the HTML file in a notebook tab. Now I just need to figure out how to disable clicking of links because that causes a X Window System Error. I guess I should be careful what I wish for.
Anyway, I was also going to ask if you are interested in an updated silverdragon? I made several updates which actually improve the usability. I would leave out the HTML business because the user would then have to find and install python webkit which was in itself an ordeal. Thanks for the reply.
Please Log in or Create an account to join the conversation.
7 years 3 months ago #139337
by cmorley
Replied by cmorley on topic Help with python scrolledwindow
Glad I could help.
Maybe I should add show_all() to init_show_windows() - it's not often people add their own widgets so I probably never caught this....
I would happily updates silverdragon in linuxcnc.
If you felt like writing up some docs for silverdragon I would add that (which would make it standout more and probably used more.)
Chris M
Maybe I should add show_all() to init_show_windows() - it's not often people add their own widgets so I probably never caught this....
I would happily updates silverdragon in linuxcnc.
If you felt like writing up some docs for silverdragon I would add that (which would make it standout more and probably used more.)
Chris M
Please Log in or Create an account to join the conversation.
7 years 3 months ago #139422
by persei8
Replied by persei8 on topic Help with python scrolledwindow
I can do that. Do you have an HTML documentation template? If not, I think I can reuse an existing one from the documentation pages. Do you prefer to use the forum or is there another communication channel?
Please Log in or Create an account to join the conversation.
7 years 3 months ago - 7 years 3 months ago #139539
by cmorley
Replied by cmorley on topic Help with python scrolledwindow
That's great!
I don't have a template - I hand write my docs as I go.
Forum is fine or linuxcnc dev mail list
Chris
I don't have a template - I hand write my docs as I go.
Forum is fine or linuxcnc dev mail list
Chris
Last edit: 7 years 3 months ago by cmorley.
Please Log in or Create an account to join the conversation.
Time to create page: 0.084 seconds