Some updates to go with changes in current CVS.
Added wxSplashScreen. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13399 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -480,24 +480,19 @@ class wxPythonDemo(wxFrame):
|
||||
#---------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
wxInitAllImageHandlers()
|
||||
class MySplashScreen(wxSplashScreen):
|
||||
def __init__(self):
|
||||
bmp = wxImage('bitmaps/splash.gif').ConvertToBitmap()
|
||||
wxSplashScreen.__init__(self, bmp,
|
||||
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
|
||||
4000, None, -1)
|
||||
EVT_CLOSE(self, self.OnClose)
|
||||
|
||||
self.splash = SplashScreen(None, bitmapfile='bitmaps/splash.gif',
|
||||
duration=4000, callback=self.AfterSplash)
|
||||
self.splash.Show(true)
|
||||
wxYield()
|
||||
return true
|
||||
|
||||
|
||||
def AfterSplash(self):
|
||||
self.splash.Close(true)
|
||||
def OnClose(self, evt):
|
||||
frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)")
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
self.ShowTip(frame)
|
||||
|
||||
evt.Skip()
|
||||
|
||||
def ShowTip(self, frame):
|
||||
try:
|
||||
@@ -505,7 +500,6 @@ class MyApp(wxApp):
|
||||
showTip, index = eval(showTipText)
|
||||
except IOError:
|
||||
showTip, index = (1, 0)
|
||||
#print showTip, index
|
||||
if showTip:
|
||||
tp = wxCreateFileTipProvider("data/tips.txt", index)
|
||||
showTip = wxShowTip(frame, tp)
|
||||
@@ -513,6 +507,21 @@ class MyApp(wxApp):
|
||||
open("data/showTips", "w").write(str( (showTip, index) ))
|
||||
|
||||
|
||||
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
"""
|
||||
Create and show the splash screen. It will then create and show
|
||||
the main frame when it is time to do so.
|
||||
"""
|
||||
wxInitAllImageHandlers()
|
||||
splash = MySplashScreen()
|
||||
splash.Show()
|
||||
wxYield()
|
||||
return true
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
|
@@ -18,7 +18,7 @@ on the command line.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import sys, os
|
||||
from wxPython.wx import *
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
@@ -60,9 +60,9 @@ class RunDemoApp(wxApp):
|
||||
# otherwise the demo made its own frame, so just put a
|
||||
# button in this one
|
||||
if hasattr(frame, 'otherWin'):
|
||||
wxButton(frame, 1101, " Exit ")
|
||||
b = wxButton(frame, -1, " Exit ")
|
||||
frame.SetSize((200, 100))
|
||||
EVT_BUTTON(frame, 1101, self.OnButton)
|
||||
EVT_BUTTON(frame, b.GetId(), self.OnButton)
|
||||
else:
|
||||
# It was probably a dialog or something that is already
|
||||
# gone, so we're done.
|
||||
|
@@ -8,6 +8,10 @@
|
||||
from wxPython.wx import *
|
||||
|
||||
class MyFrame(wxFrame):
|
||||
"""
|
||||
This is MyFrame. It just shows a few controls on a wxPanel,
|
||||
and has a simple menu.
|
||||
"""
|
||||
def __init__(self, parent, title):
|
||||
wxFrame.__init__(self, parent, -1, title, size=(350, 200))
|
||||
|
||||
@@ -20,7 +24,8 @@ class MyFrame(wxFrame):
|
||||
|
||||
panel = wxPanel(self, -1)
|
||||
if wxPlatform == "__WXMAC__":
|
||||
text = wxStaticText(panel, -1, "Hello World!\nWhere is my menu?")
|
||||
text = wxStaticText(panel, -1,
|
||||
"Hello World!\nWhere is my menu?")
|
||||
else:
|
||||
text = wxStaticText(panel, -1, "Hello World!")
|
||||
text.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD))
|
||||
@@ -39,6 +44,7 @@ class MyFrame(wxFrame):
|
||||
|
||||
|
||||
def OnButton(self, evt):
|
||||
"""Event handler for the button click."""
|
||||
print "OnButton"
|
||||
self.Close()
|
||||
|
||||
|
@@ -12,6 +12,7 @@ class MyCanvas(wxScrolledWindow):
|
||||
self.lines = []
|
||||
self.maxWidth = 1000
|
||||
self.maxHeight = 1000
|
||||
self.count = 0
|
||||
|
||||
self.SetBackgroundColour(wxNamedColor("WHITE"))
|
||||
EVT_LEFT_DOWN(self, self.OnLeftButtonEvent)
|
||||
@@ -36,9 +37,12 @@ class MyCanvas(wxScrolledWindow):
|
||||
|
||||
|
||||
def OnPaint(self, event):
|
||||
#self.count += 1
|
||||
#print self.count, "begin paint...",
|
||||
dc = wxPaintDC(self)
|
||||
self.PrepareDC(dc)
|
||||
self.DoDrawing(dc)
|
||||
#print "end paint"
|
||||
|
||||
|
||||
def DoDrawing(self, dc):
|
||||
@@ -108,7 +112,6 @@ class MyCanvas(wxScrolledWindow):
|
||||
dc.EndDrawing()
|
||||
|
||||
|
||||
|
||||
def DrawSavedLines(self, dc):
|
||||
dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4))
|
||||
for line in self.lines:
|
||||
|
Reference in New Issue
Block a user