|
2009-05-26
, 02:15
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#2
|
#!/usr/bin/env python2.5 import gtk import hildon class Example(hildon.Program): def __init__(self): hildon.Program.__init__(self) self.window = hildon.Window() self.window.connect("destroy", self.close_application) self.window.connect("key-press-event", self.on_key_press) self.window.connect("window-state-event", self.on_window_state_change) self.add_window(self.window) def on_window_state_change(self, widget, event, *args): if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN: self.window_in_fullscreen = True else: self.window_in_fullscreen = False def on_key_press(self, widget, event, *args): if event.keyval == gtk.keysyms.F6: # The "Full screen" hardware key has been pressed if self.window_in_fullscreen: self.window.unfullscreen() else: self.window.fullscreen() def close_application(self, widget): gtk.main_quit() def run(self): gtk.main() app = Example() app.run()
The Following User Says Thank You to BrentDC For This Useful Post: | ||
|
2009-05-26
, 02:42
|
Posts: 146 |
Thanked: 15 times |
Joined on Oct 2008
|
#3
|
Here is the base of an application that goes fullscreen when the fullscreen button is tapped. You can add other keys roughly the same way.
[...]
As for the other stuff, read the PyGTK tutorial.
|
2009-05-26
, 02:50
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#4
|
Yes, that is what I looked for, and it works. Do you know where I can look for the codes for the other keys?
That is what I have been doing for the last week... but didn't find the stuff I asked for.
Thanks!
L.
|
2009-05-26
, 02:53
|
Posts: 146 |
Thanked: 15 times |
Joined on Oct 2008
|
#5
|
IIRC, they are all F* keys. Zoon in = F7, zoom out = F8, etc. The d-pad ones are UP, Down, Left, Right. I'm not sure about the center one (maybe try Select).
|
2009-05-26
, 03:15
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#6
|
Great! Thanks.
I added a question while you were posting your answer, that probably you didn't see:
I observed that you used HildonWindow, HildonProgram, etc. I didn't, and the buttons work. What is the advantage of using Hildon<Stuff>?
Thanks again,
L.
The Following User Says Thank You to BrentDC For This Useful Post: | ||
|
2009-05-26
, 03:39
|
Posts: 146 |
Thanked: 15 times |
Joined on Oct 2008
|
#7
|
Using the hildon widgets allows you to use hildon-specific functions and methods e.g. adding a menu or toolbar. Since hildon widgets inherit from their gtk counterparts, you should try to use hildon widgets whenever possible (especially base widgets like hildon.Window).
|
2009-05-26
, 04:03
|
|
Posts: 903 |
Thanked: 632 times |
Joined on Apr 2008
|
#8
|
I see. Problem with that is that the very same program won't work on my linux boxes then. Perhaps I would need to do two applications...
Thanks for your help!!
Cheers,
L.
on_tablet = True try: import hildon except ImportError: on_tablet = False [...] if on_tablet: self.window = hildon.Window() else: self.window = gtk.Window()
|
2009-05-26
, 04:22
|
|
Posts: 2,427 |
Thanked: 2,986 times |
Joined on Dec 2007
|
#9
|
|
2009-05-26
, 12:39
|
|
Posts: 273 |
Thanked: 104 times |
Joined on Mar 2007
@ Manitoba, Canada
|
#10
|
I am writting a pygtk application for our N810, but I am a newbie at pygtk. I would like to know a few things:
1) How do I access the hardware N810 buttons? For example, how I do use the [+] and [-] to change the font size or volume? How do I use the middle button to make the window fullscreen?
2) How do I use the main window menu?
3) How do I make an image window, that is smaller than the image itself, to be scrollable with the mouse/finger? I know how to add scrollbars, but this is not what I want (this is certainly not a N800 related stuff).
Any help will be appreciated. Thanks!!!!!!!!!!!!!!
L.
Last edited by luis; 2009-05-26 at 02:08.