PythonCE for Windows CE

I'm playing with the PythonCE library for Windows CE devices, and I'm building a little graphic application (GUI) with it just to be sure that the chosen technology is the appropriate. I've always used the embedded VC++ and VB and I think it's time to move on and try new things. I've tested this library on my DELL Axim x50.

Firstly, you have to download the PythonCE library for your device. Download PythonCESetup.exe from sourceforge. Once downloaded, you have to execute the PythonCESetup.exe and it automatically will install the PythonCE on your WindowsCE device.

Once done, your pocket device will have installed the python command line:
Then, for executing graphical applications, we need to install the TKinter library. You'll succeed if you follow the next instructions to install the TKinter library on your pocket device:

Using TKinter for Windows CE:

To use Tkinter you have to download this additional software Tkinter.zip and unpack it on your PDA.
  1. The following archive contains 2 folders: "Windows" and "tcl8.4.3". Put all the files in "Windows" in the "Windows" folder of your PDA.
  2. Create a "lib" folder in the "Program files" folder of your PDA.
  3. Inside the "tcl8.4.3" folder in your archive you will find two folders: "library" and "tk8.4". Copy the "tk8.4" folder into the "lib" folder you just created on your PDA.
  4. Copy all the files in "library" into a folder named "tcl8.4" you will create inside the same "lib" folder.
If  you succeed, you can execute the next example and try it on our device:

from Tkinter import * 

def onCanvasClick(event):                  
    print 'Got canvas click', event.x, event.y, event.widget

root = Tk()
root.title('MyAPP')
canv = Canvas(root, width=100, height=100)
img = PhotoImage(file='\\My Documents\\logo.gif')
canv.create_image(240,250, image=img, anchor=CENTER)
obj1 = canv.create_text(50, 30, fill="red", text='text1')
obj2 = canv.create_text(50, 70, fill="red", text='text2')
widget = Label(root, text='This is a Label')
widget.config(bg='black', fg='yellow')             
widget.pack(expand=YES, fill=BOTH)
canv.bind('<Double-1>', onCanvasClick)                  
canv.pack()
root.mainloop()

Output Example:

Related links:

Comments

Popular Posts