more minor demo tweaks

This commit is contained in:
Robin Dunn
2016-08-02 21:55:15 -07:00
parent 1bdac0af63
commit 65959b71d1
4 changed files with 19 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ class TestPanel(wx.Panel):
self.elb = wx.adv.EditableListBox(
self, -1, "List of Stuff", (50,50), (250, 250),
style=wx.adv.EL_DEFAULT_STYLE |
wx.adv.EL_NO_REORDER |
#wx.adv.EL_NO_REORDER |
wx.adv.EL_ALLOW_NEW |
wx.adv.EL_ALLOW_EDIT |
wx.adv.EL_ALLOW_DELETE)

View File

@@ -2,12 +2,13 @@
#---------------------------------------------------------------------------
# Name: EventManager.py
# Purpose: A module to demonstrate wxPython.lib.evtmgr.EventManager.
# Purpose: A module to demonstrate wx.lib.evtmgr.EventManager.
#
# Author: Robb Shecter (robb@acm.org)
#
# Created: 16-December-2002
# Copyright: (c) 2002 by Robb Shecter (robb@acm.org)
# Copyright: (c) 2002-2016 by Robb Shecter (robb@acm.org),
# Total Control Software
# Licence: wxWindows license
#---------------------------------------------------------------------------
@@ -136,7 +137,7 @@ class InnerTile(wx.Window):
FINAL_COLOR = wx.Colour( 20, 80,240)
OFF_COLOR = wx.Colour(185,190,185)
# Some pre-computation.
DELTAS = map(lambda a,b: b-a, START_COLOR.Get(), FINAL_COLOR.Get())
DELTAS = list(map(lambda a,b: b-a, START_COLOR.Get(), FINAL_COLOR.Get()))
START_COLOR_TUPLE = START_COLOR.Get()
"""
@@ -185,7 +186,8 @@ class InnerTile(wx.Window):
self.makeColorFromTuple(mouseEvent.GetPosition())
def makeColorFromTuple(self, (x, y)):
def makeColorFromTuple(self, xy):
x, y = xy
MAX = 180.0
scaled = min((x + y) * self.factor, MAX) # In range [0..MAX]
percent = scaled / MAX

View File

@@ -18,9 +18,7 @@ class FileCtrl(wx.FileCtrl):
pos=wx.DefaultPosition, size=wx.DefaultSize, name="filectrl", log=None):
wx.FileCtrl.__init__(self, parent, id, defaultDirectory, defaultFilename,
wildCard, style, pos, size, name)
self.BackgroundColour = 'pink'
self.log = log
self.Bind(wx.EVT_FILECTRL_FILEACTIVATED, self.OnFileActivated)
self.Bind(wx.EVT_FILECTRL_SELECTIONCHANGED, self.OnSelectionChanged)
@@ -49,8 +47,12 @@ class TestPanel(wx.Panel):
self.log = log
wx.Panel.__init__(self, parent)
fc = FileCtrl(self, pos=(15,15), log=log)
wx.StaticText(self, -1,
"This is a generic control with features like a file dialog",
pos=(10,10))
fc = FileCtrl(self, pos=(10,35), log=log)
fc.SetSize((500,350))
fc.BackgroundColour = 'sky blue'
#---------------------------------------------------------------------------

View File

@@ -6,12 +6,11 @@ import wx
#----------------------------------------------------------------------
text = """\
Right-click on the panel above the line to get a menu. This menu will
be managed by a FileHistory object and so the files you select will
automatically be added to the end of the menu and will be selectable
the next time the menu is viewed. The filename selected, either via the
Open menu item, or from the history, will be displayed in the log
window below.
Right-click on this panel to get a menu. This menu will be managed by a
FileHistory object and so the files you select will automatically be added to
the end of the menu and will be selectable the next time the menu is viewed.
The filename selected, either via the Open menu item, or from the history,
will be displayed in the log window below.
"""
#----------------------------------------------------------------------