================= WebTK v0.alpha3 ================= Find a new alpha-release of WebTK: http://www.webtk.org/ It includes a brand new data model (featuring data events!), a Forum application and a refactored module architecture. The examples below have been updated to reflect changes. What is WebTK ? =============== WebTK is a Python framework, using Twisted as its underlying Web server, and allowing webmasters to develop websites like any classic GUI software. It is object-oriented, providing and handling event-based widgets. It also does not need any database to work, as it uses objects persitance, with the help of PyPerSyst. Disclaimer ========== Please note that the alpha series are mainly for developers that want to have a look at WebTK internals - there are plenty of bugs, dirty tricks and the installation is not easy. This is NOT for production websites. URLs ==== You can find more about WebTK here : Homepage : http://www.webtk.org/ Download : http://www.webtk.org/download/ Web CVS : http://cvs.plebia.org/index.py/?cvsroot=webtk Current API : http://www.webtk.org/doc/current/api/ Changelog : http://www.webtk.org/Changelog Examples ======== To give you some idea of what WebTK is, here is some small sample websites, working with the alpha3 version. It shows an image whose content change each time you click on it: # Modules ################################################################# import sys from webtk.core.system import Session from webtk.widget.window import RootWindow from webtk.widget.display import Pixmap # Classes ################################################################# class MySession(Session): def init(self): window = RootWindow(wtkTitle='WebTK Test') self.wtkAddRootObject(window) image = PlebiaPlonePixmap() window.wtkAppendChild(image) class PlebiaPlonePixmap(Pixmap): def init(self): self.ploneURI = 'http://plone.org/logo.jpg' self.plebiaURI = 'http://www.plebia.org/images/logo.png' self.wtkURI = self.plebiaURI self.wtkAddEvent('click', self.onClick) def onClick(self): if self.wtkURI == self.plebiaURI: self.wtkURI = self.ploneURI else: self.wtkURI = self.plebiaURI Here is a slighlty more elaborated one, which uses a Poll widget to ask the visitor an important question ! # Modules ################################################################# import sys from webtk.core.system import Session from webtk.widget.window import RootWindow from webtk.widget.app.poll import Poll, PollResult from webtk.data.base import Data # Classes ################################################################# class MySession(Session): def init(self): # Poll window = RootWindow(wtkTitle='WebTK Test Poll') self.wtkAddRootObject(window) pollData = self.wtkSystem.wtkPoolGet('poll') if pollData is None: pollData = self.wtkSystem.wtkPoolRegister('poll', Data) question = Data() question.wtkTitle = 'Do you like WebTK ?' for ans in ['Yes, sure.', 'Mmmh, I do not know.', 'Bah!']: answer = Data() answer.wtkTitle = ans answer.wtkNbVotes = 0 question.wtkAppendChild(answer) pollData.wtkAppendChild(question) question = Data() question.wtkTitle = 'Will you use it ?' for ans in ['For all my future websites!', 'Perhaps...', 'Never!']: answer = Data() answer.wtkTitle = ans answer.wtkNbVotes = 0 question.wtkAppendChild(answer) pollData.wtkAppendChild(question) pollResult = PollResult(wtkPollData=pollData) pollResult.wtkIsVisible = 0 poll = TestPoll(wtkPollData=pollData, pollResult=pollResult) window.wtkAppendChild(poll) window.wtkAppendChild(pollResult) class TestPoll(Poll): def init(self, pollResult): self.pollResult = pollResult self.wtkAddEvent('onSelectAnswer', self.wtkCallbackOnSelectAnswer) def wtkCallbackOnSelectAnswer(self): self.pollResult.wtkIsVisible = 1 -- Xavier.
participants (1)
-
Xavier Antoviaque