Help with python scrolledwindow
14 Jul 2019 15:05 - 14 Jul 2019 15:29 #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: 14 Jul 2019 15:29 by persei8. Reason: Added a file
Please Log in or Create an account to join the conversation.
14 Jul 2019 17:24 #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.
14 Jul 2019 19:22 #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.
14 Jul 2019 23:06 #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.
15 Jul 2019 13:39 #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.
16 Jul 2019 04:11 - 16 Jul 2019 04:18 #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: 16 Jul 2019 04:18 by cmorley.
Please Log in or Create an account to join the conversation.
17 Jul 2019 00:48 #139655
by cmorley
Replied by cmorley on topic Help with python scrolledwindow
I messaged you
Chris
Chris
Please Log in or Create an account to join the conversation.
18 Jul 2019 11:50 #139785
by andypugh
Replied by andypugh on topic Help with python scrolledwindow
(I temp-deleted the email to hide the email address from casual scrutiny)
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19188
- Thank you received: 6430
18 Jul 2019 12:01 #139788
by tommylight
Replied by tommylight on topic Help with python scrolledwindow
Thought the same thing, but it would be nice to have a visit from "not petya" or "wanacry", that would discurage them from showing e-mail addresses on public forums.(I temp-deleted the email to hide the email address from casual scrutiny)
Please Log in or Create an account to join the conversation.
18 Jul 2019 15:21 #139819
by persei8
Replied by persei8 on topic Help with python scrolledwindow
Thanks for doing that. Since this forum has no PM facility, I don't know how else to communicate 1 to 1 with someone and not clog up the forum with irrelevant posts and not expose file attachments to the general public. However, I should have at least obfuscated it with someone at somewhere dot com.
Please Log in or Create an account to join the conversation.
Time to create page: 0.316 seconds