Click here to Skip to main content
15,891,704 members
Articles / Desktop Programming / MFC

A skinned dialog in Python and MFC

Rate me:
Please Sign up or sign in to vote.
4.29/5 (4 votes)
24 Jul 2011CPOL3 min read 47.9K   6.6K   35  
Help to make a skinned dialog program easily in Python, XML with a UI window DLL.
## include header files
import win32api, win32con, win32gui 
import win32ui
import win32con
import string
from ctypes import *
from BrandNewUI import *

class Dictionaray:
	search_keyword = ''
	url = ''
	state = 'google'
	def Search(self):
		if self.state == 'wiki':
			self.url = "http://mobile.wikipedia.org/transcode.php?go=%s" % self.search_keyword
			pass
		if self.state == 'google':
			self.url = "http://www.google.com/dictionary?langpair=en|en&q=%s&hl=ko&aq=f" % self.search_keyword
			pass
		DictionarySkin.SendSkinMessage("webpage","url",self.url)
		pass

Dic = Dictionaray()

def SkinWndProc(str):
	operator = string.split(str.value,"/")
	print str
	if operator[0] == "btn_wiki" and operator[1] == "btnup":
		Dic.state = 'wiki'
		print operator[2]
		Dic.Search()
		pass
	if operator[0] == "btn_google" and operator[1] == "btnup":
		Dic.state = 'google'
		Dic.Search()
		pass
	if operator[0] == "btn_close":
		DictionarySkin.SendSkinMessage("wndmgr","cls","WebDic")
		DictionarySkin.FinalSkin()
		EndPumpMessage()
		pass
	if operator[1] == "input":
		print operator[2]
		Dic.search_keyword = operator[2]
		Dic.Search()
		pass
	pass

DictionarySkin = CBrandNewUI(".\BrandNewUI.dll",".\DicSkin\Skin.xml")
DictionarySkin.LoadModule()
DictionarySkin.InitSkin()
DictionarySkin.SetAppHwnd()
DictionarySkin.GetSkinMessage()
DictionarySkin.SendSkinMessage("wndmgr","opn","webdic")
DictionarySkin.SetSkinProc(SkinWndProc)

StartPumpMessage()

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer SEC
Korea (Republic of) Korea (Republic of)
Worked and Working as Windows, Game Software, Mobile Developer.

Comments and Discussions