Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

Reference of keyCodes

    switch (oEvent.keyCode) {
       case 38: //up arrow  
       case 40: //down arrow
       case 37: //left arrow
       case 39: //right arrow
       case 33: //page up  
       case 34: //page down  
       case 36: //home  
       case 35: //end                  
       case 13: //enter  
       case 9: //tab  
       case 27: //esc  
       case 16: //shift  
       case 17: //ctrl  
       case 18: //alt  
       case 20: //caps lock
       case 8: //backspace  
       case 46: //delete
           return true;
           break;

       default: 

Note: When capturing combination keys there is dedicated boolean attributes for each of the special keys (CTRL, SHIFT, ALT).
Reference: Make Life Easy With Autocomplete Textboxes [JavaScript & AJAX Tutorials] [sitepoint.com]

Python - Mouse Capture

// Minimo Esempio di pannello con evento

import wx

class MyFrame(wx.Frame):
    
    def __init__(self):
        
        # creo un frame
        wx.Frame.__init__(self, None, -1, 'My Frame', size=(300, 300))
        # aggiungo un pannello
        panel = wx.Panel(self, -1)
        # aggiungo un evento al pannello
        panel.Bind(wx.EVT_MOTION, self.OnMove)
        # aggiungo un controllo di testo
        self.posCtrl = wx.TextCtrl(panel, -1, 'Pos: ', pos=(40, 10))
        
    def OnMove(self, event):
        
        # catturo la posizione del mouse
        pos = event.GetPosition()
        # scrivo tale posizione nel controllo di testo
        self.posCtrl.SetValue('%s, %s' % (pos.x, pos.y))
        
if '__main__' == __name__:
    
    app = wx.PySimpleApp()
    frame = MyFrame()
    frame.Show()
    app.MainLoop()

taking a screenshot

In py_s60 1.1.0, we can take a screenshot using camera module.
In 1.1.3, however, the feature is moved to the new graphics module.

Here's a quick example.
import graphics
im = graphics.screenshot()
im.save(u'C:\\test.png')

You may notice the difference. Now you can save it in 'jpg' or 'png'
as you like by specifying the filename.
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS