wxpython-users Digest, Vol 14, Issue 159

My message seems to get spoiled by encoding. Just try again. Sorry for spamming.

Hi,

I’m trying to adjust the TimeCtrl widget in wx.lib.masked for touch

screen use. After fiddling the font size of the time box, and button

size of the spin button, I got something that nearly suits my need,

however, the white space on the time box is wasteful.

Can anyone tell me how to shink the whitespace, please? Really

appreciate that.

Thanks

Cliff

Sample Code:

import wx

from wx.lib.masked import TimeCtrl

wxEVT_TIMEVAL_UPDATED = wx.NewEventType()

EVT_TIMEUPDATE = wx.PyEventBinder(wxEVT_TIMEVAL_UPDATED, 1)

if name == ‘main’:

 import traceback

class TestPanel(wx.Panel):

     def __init__(self, parent, id,

                  pos = wx.DefaultPosition, size = wx.DefaultSize,

                  fmt24hr = 0, test_mx = 0,

                  style = wx.TAB_TRAVERSAL ):

wx.Panel.init(self, parent, id, pos, size, style)

self.test_mx = test_mx

self.tc = TimeCtrl(self, 10, fmt24hr = fmt24hr,

display_seconds = False)

         self.tc.SetFont(wx.Font(30,wx.SWISS,wx.NORMAL,wx.NORMAL))

         sb = wx.SpinButton( self, 20, wx.DefaultPosition,

(100,80), 0 )

         self.tc.BindSpinButton(sb)

sizer = wx.BoxSizer( wx.HORIZONTAL )

         sizer.Add( [self.tc](http://self.tc), 0, wx.ALIGN_CENTRE|wx.ALL, 5 )

         sizer.Add( sb, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )

self.SetAutoLayout( True )

         self.SetSizer( sizer )

         sizer.Fit( self )

         sizer.SetSizeHints( self )

self.Bind(EVT_TIMEUPDATE, self.OnTimeChange, self.tc)

def OnTimeChange(self, event):

dbg('OnTimeChange: value = ', event.GetValue())

         wxdt = self.tc.GetWxDateTime()

dbg(‘wxdt =’, wxdt.GetHour(), wxdt.GetMinute(),

wxdt.GetSecond())

         if self.test_mx:

             mxdt = self.tc.GetMxDateTime()

dbg(‘mxdt =’, mxdt.hour, mxdt.minute, mxdt.second)

class MyApp(wx.App):

     def OnInit(self):

         import sys

         fmt24hr = '24' in sys.argv

         test_mx = 'mx' in sys.argv

         try:

             frame = wx.Frame(None, -1, "TimeCtrl Test")

             sizer = wx.BoxSizer()

             panel = TestPanel(frame, -1, (-1,-1), fmt24hr=fmt24hr,

test_mx = test_mx)

             sizer.Add(panel)

             frame.Show(True)

             frame.SetSizerAndFit(sizer)

         except:

             traceback.print_exc()

             return False

         return True

try:

     app = MyApp(0)

     app.MainLoop()

 except:

     traceback.print_exc()
···

2009/4/29 wxpython-users-request@lists.wxwidgets.org

Send wxpython-users mailing list submissions to

    wxpython-users@lists.wxwidgets.org

To subscribe or unsubscribe via the World Wide Web, visit

    [http://lists.wxwidgets.org/mailman/listinfo/wxpython-users](http://lists.wxwidgets.org/mailman/listinfo/wxpython-users)

or, via email, send a message with subject or body ‘help’ to

    wxpython-users-request@lists.wxwidgets.org

You can reach the person managing the list at

    wxpython-users-owner@lists.wxwidgets.org

When replying, please edit your Subject line so it is more specific

than “Re: Contents of wxpython-users digest…”

Today’s Topics:

  1. Re: Python plug-in framework (Tom Clerckx)

  2. FW: AuiMDIParent method issue (Devendran Chandra)

  3. TimeCtrl for touch screen usage (Cliff Xuan)


Message: 1

Date: Wed, 29 Apr 2009 08:14:05 +0200

From: Tom Clerckx tclerckx@gmail.com

Subject: [wxpython-users] Re: Python plug-in framework

To: wxpython-users@lists.wxwidgets.org

Message-ID:

    <6dffb9f70904282314p670cc386g7f9f7973ea17e24b@mail.gmail.com>

Content-Type: text/plain; charset=“iso-8859-1”

You can do that, but you need to set the parent of the plugin panel to

be the panel that owns the sizer, not the frame.

Regards,

Nate

I see now.

I know now :slight_smile:

Thanks.

Tom.

Experience is what you get when you don’t get what you wanted.

-------------- next part --------------

An HTML attachment was scrubbed…

URL: [http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200904=

29/da66d2e7/attachment-0001.htm](http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200904= 29/da66d2e7/attachment-0001.htm)


Message: 2

Date: Wed, 29 Apr 2009 06:28:07 +0000

From: Devendran Chandra superdev81@hotmail.com

Subject: [wxpython-users] FW: AuiMDIParent method issue

To: wxpython-users@lists.wxwidgets.org

Message-ID: BAY106-W52BEEA0BAFB6BCA9B1C42CD06F0@phx.gbl

Content-Type: text/plain; charset=“windows-1252”

Skipped content of type multipart/alternative-------------- next part -----=



ActivePython mailing list

ActivePython@listserv.ActiveState.com

To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

-------------- next part --------------

#!/usr/bin/env python

import wx

import wx.aui

#----------------------------------------------------------------------

class ParentFrame(wx.aui.AuiMDIParentFrame):

def __init__(self, parent):

    wx.aui.AuiMDIParentFrame.__init__(self, parent, -1,

                                      title=3D"Oven Management System",

                                      size=3D(640,480),

                                      style=3Dwx.DEFAULT_FRAME_STYLE)

    self.count =3D 0

    mb =3D wx.MenuBar()

    self.mb=3Dmb

    file_menu =3D wx.Menu()

    new_item =3D file_menu.Append(-1, "Create new child window")

    self.Bind(wx.EVT_MENU, self.create, new_item)

    new_item1 =3D file_menu.Append(-1, "Choose child window")

    self.Bind(wx.EVT_MENU, self.choose, new_item1)

    new_item2 =3D file_menu.Append(-1, "Close parent")

    self.Bind(wx.EVT_MENU, self.OnDoClose, new_item2)

    mb.Append(file_menu, "File")

    self.SetMenuBar(mb)

    self.CreateStatusBar()

    self.SetMenuBar(mb)

    self.child=3D[] =



   =



def create(self, evt):

    for i in range(5):

        self.child.append(ChildFrame(self, i,self.mb))

   =



def choose(self,evt):

    self.SetActiveChild(self.child[2])



def OnDoClose(self, evt):

    self.Close()

#--------------------------------------------------------------------------=


class ChildFrame(wx.aui.AuiMDIChildFrame):

def __init__(self,parent,count,mb):

    wx.aui.AuiMDIChildFrame.__init__(self, parent, -1,

                                     title=3D"BIST: %d" % count)     =



    menu =3D wx.Menu()

    item =3D menu.Append(-1, "This is BIST %d's menu" % count)

   =

#--------------------------------------------------------------------------=


class MainApp(wx.App):

def OnInit(self):

    self.frame =3DParentFrame(None)

    self.frame.Show(True)

    return True

if name =3D=3D ‘main’:

app =3D MainApp(0)

app.MainLoop()

Message: 3

Date: Wed, 29 Apr 2009 11:55:16 +0100

From: Cliff Xuan cliff.xuan@gmail.com

Subject: [wxpython-users] TimeCtrl for touch screen usage

To: wxpython-users@lists.wxwidgets.org

Message-ID:

    <a02a77290904290355w5e645db7padc06176b07be36a@mail.gmail.com>

Content-Type: text/plain; charset=“utf-8”

U2tpcHBlZCBjb250ZW50IG9mIHR5cGUgbXVsdGlwYXJ0L2FsdGVybmF0aXZlLS0tLS0tLS0tLS0t

LS0gbmV4dCBwYXJ0IC0tLS0tLS0tLS0tLS0tCkEgbm9uLXRleHQgYXR0YWNobWVudCB3YXMgc2Ny

dWJiZWQuLi4KTmFtZTogdGltZUN0cmwucHkKVHlwZTogdGV4dC94LXB5dGhvbgpTaXplOiAyMzAx

IGJ5dGVzCkRlc2M6IG5vdCBhdmFpbGFibGUKVXJsIDogaHR0cDovL2xpc3RzLnd4d2lkZ2V0cy5v

cmcvcGlwZXJtYWlsL3d4cHl0aG9uLXVzZXJzL2F0dGFjaG1lbnRzLzIwMDkwNDI5LzNmNWJlZjlh

L3RpbWVDdHJsLnB5Ci0tLS0tLS0tLS0tLS0tIG5leHQgcGFydCAtLS0tLS0tLS0tLS0tLQpBIG5v

bi10ZXh0IGF0dGFjaG1lbnQgd2FzIHNjcnViYmVkLi4uCk5hbWU6IHRpbWUgY29udHJvbC5KUEcK

VHlwZTogaW1hZ2UvanBlZwpTaXplOiAxMDY4NSBieXRlcwpEZXNjOiBub3QgYXZhaWxhYmxlClVy

bCA6IGh0dHA6Ly9saXN0cy53eHdpZGdldHMub3JnL3BpcGVybWFpbC93eHB5dGhvbi11c2Vycy9h

dHRhY2htZW50cy8yMDA5MDQyOS8zZjViZWY5YS90aW1lY29udHJvbC5qcGVnCg==



wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

End of wxpython-users Digest, Vol 14, Issue 159