Opinion on new library

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Opinion on new library

Jack Burridge
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

johnf
have you looked at Dabo? www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:



This has the ability to add the two spinners as they change. The source is here https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="tdPJe47tAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bimb...@...> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="tdPJe47tAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by Jack Burridge
Here is the code

import wx
from easyDialog import Ctrl

class Panel(wx.Frame):
    name = 'noname'
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        wx.Frame.__init__(self, parent, id, *args, **kwargs)
        self.gauge = Ctrl.Gauge(0, maxvalue=100, horz=wx.HORIZONTAL)
        self.result = Ctrl.StaticText('0')
        self.spin1 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        self.spin2 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        # ----- > The layout
        mp = Ctrl.MakePairs
        sizer= mp([
                   (self.spin1, Ctrl.StaticText( '+'), self.spin2),  # first controls row
                   mp( [self.result], horzCenter=True, proportion=1), # second controls row
                   self.gauge, # third controls row
                  ], # The controls as list or tuple
                  horz=wx.VERTICAL, # the Layout
                  title='Hello', # an staticboxsizer with a string
                  flag=wx.ALL|wx.EXPAND, # control's flag
                  horzCenter=True) # to horizontally center the sizer container
       # ----- <
        self.SetSizer( sizer( self)) # sizer(self) to the stuff, i.e. the callbacks, the Layout, .... 
        self.Layout()



El martes, 15 de noviembre de 2016, 12:58:56 (UTC-5), Jack Burridge escribió:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by sebastian lópez
Here is the code

import wx
from easyDialog import Ctrl
class Panel(wx.Frame):
    name = 'noname'
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        wx.Frame.__init__(self, parent, id, *args, **kwargs)
        self.gauge = Ctrl.Gauge(0, maxvalue=100, horz=wx.HORIZONTAL)
        self.result = Ctrl.StaticText('0')
        self.spin1 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        self.spin2 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        # ----- > The layout
        mp = Ctrl.MakePairs
        sizer= mp([
                   (self.spin1, Ctrl.StaticText( '+'), self.spin2),  # first controls row
                   mp( [self.result], horzCenter=True, proportion=1), # second controls row
                   self.gauge, # third controls row
                  ], # The controls as list or tuple
                  horz=wx.VERTICAL, # the Layout
                  title='Hello', # an statixboxsizer with a string
                  flag=wx.ALL|wx.EXPAND, # control's flag
                  horzCenter=True) # to horizontal center the sizer container
        # ----- <
        self.SetSizer( sizer( self)) # sizer(self) to the stuff, i.e. the callbacks, the Layouth, ....
        self.Layout()
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by sebastian lópez
Here is the code

import wx
from easyDialog import Ctrl
class Panel(wx.Frame):
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        wx.Frame.__init__(self, parent, id, *args, **kwargs)
        self.gauge = Ctrl.Gauge(0, maxvalue=100, horz=wx.HORIZONTAL)
        self.result = Ctrl.StaticText('0')
        self.spin1 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        self.spin2 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))

        # ----- > The layout
        mp = Ctrl.MakePairs
        sizer= mp([
                   (self.spin1, Ctrl.StaticText( '+'), self.spin2),  # first controls row
                   mp( [self.result], horzCenter=True, proportion=1), # second controls row
                   self.gauge, # third controls row
                  ], # The controls as list or tuple
                  horz=wx.VERTICAL, # the Layout
                  title='Hello', # an staticboxsizer with a string
                  flag=wx.ALL|wx.EXPAND, # control's flag
                  horzCenter=True) # to horizontally center the sizer container
        # ----- <
        self.SetSizer( sizer( self)) # sizer(self) do the stuff, i.e. the callbacks, the Layout, ....
        self.Layout()



El miércoles, 16 de noviembre de 2016, 9:11:37 (UTC-5), sebastián lópez escribió:
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Chris Barker - NOAA Federal
You may want to take a look at Enthought Tool Suite traits and traitsUI:


I think they have been focused on QT for the UI recently, but the underlying traits system is pretty powerful.

-CHB

Sent from my iPhone

On Nov 16, 2016, at 6:53 AM, sebastián lópez <[hidden email]> wrote:

Here is the code

import wx
from easyDialog import Ctrl
class Panel(wx.Frame):
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        wx.Frame.__init__(self, parent, id, *args, **kwargs)
        self.gauge = Ctrl.Gauge(0, maxvalue=100, horz=wx.HORIZONTAL)
        self.result = Ctrl.StaticText('0')
        self.spin1 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))
        self.spin2 = Ctrl.SpinCtrl(0, 50, 0).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.gauge.SetValue( self.spin1.Value+self.spin2.Value)).\
            Bind(wx.EVT_SPINCTRL, lambda evt: self.result.SetValue( str( self.spin1.Value+self.spin2.Value)))

        # ----- > The layout
        mp = Ctrl.MakePairs
        sizer= mp([
                   (self.spin1, Ctrl.StaticText( '+'), self.spin2),  # first controls row
                   mp( [self.result], horzCenter=True, proportion=1), # second controls row
                   self.gauge, # third controls row
                  ], # The controls as list or tuple
                  horz=wx.VERTICAL, # the Layout
                  title='Hello', # an staticboxsizer with a string
                  flag=wx.ALL|wx.EXPAND, # control's flag
                  horzCenter=True) # to horizontally center the sizer container
        # ----- <
        self.SetSizer( sizer( self)) # sizer(self) do the stuff, i.e. the callbacks, the Layout, ....
        self.Layout()



El miércoles, 16 de noviembre de 2016, 9:11:37 (UTC-5), sebastián lópez escribió:
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge
In reply to this post by sebastian lópez
Sebastián,
Would it be possible to see your full code? Also the method you suggest is not thread safe, so the data could not be modified outside of the event loop


On Wednesday, 16 November 2016 14:11:37 UTC, sebastián lópez wrote:
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez

Yes, I attached the code,

Actually it's tested under python 2.7 and wxpython 3.0


El miércoles, 16 de noviembre de 2016, 12:39:58 (UTC-5), Jack Burridge escribió:
Sebastián,
Would it be possible to see your full code? Also the method you suggest is not thread safe, so the data could not be modified outside of the event loop


On Wednesday, 16 November 2016 14:11:37 UTC, sebastián lópez wrote:
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

example.zip (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by Jack Burridge
It's possible to rewrite the code into this

import wx
from easyDialog import Ctrl
class Panel(wx.Frame):
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        wx.Frame.__init__(self, parent, id, *args, **kwargs)
        self.gauge = Ctrl.Gauge(0, maxvalue=100, horz=wx.HORIZONTAL)
        self.result = Ctrl.StaticText('0')
        self.spin1 = Ctrl.SpinCtrl(0, 50, 0).Bind(wx.EVT_SPINCTRL, self.On_change)
        self.spin2 = Ctrl.SpinCtrl(0, 50, 0).Bind(wx.EVT_SPINCTRL, self.On_change)

        # ----- > The layout
        mp = Ctrl.MakePairs
        sizer= mp([
                   (self.spin1, Ctrl.StaticText( '+'), self.spin2),
                   mp( [self.result], horzCenter=True, proportion=1),
                   self.gauge,
                  ],
                  horz=wx.VERTICAL,
                  title='Hello',
                  flag=wx.ALL|wx.EXPAND,
                  horzCenter=True)
        # ----- <
        self.SetSizer( sizer( self))
        self.Layout()
    def On_change(self, evt):
              self.gauge.SetValue( self.spin1.Value + self.spin2.Value)
              self.result.SetValue( str( self.spin1.Value + self.spin2.Value))


In case you want to make it threat safe you should customize the callback.


El miércoles, 16 de noviembre de 2016, 12:39:58 (UTC-5), Jack Burridge escribió:
Sebastián,
Would it be possible to see your full code? Also the method you suggest is not thread safe, so the data could not be modified outside of the event loop


On Wednesday, 16 November 2016 14:11:37 UTC, sebastián lópez wrote:
Hello,

I'm thinking about your aproach and I guess it can be confuse to the user to use a diferent watcher depending of the control type

SpinWatcher --> SpinCtrl
LabelWatcher --> LabelCtrl
ValueWatcher --> ***Ctrl
.....
dateWatcher --> DateCtrl


So I think it could be better to provide a single watcher
Watcher ---> SpinCtrl
Watcher ---> LabelCtrl
Watcher ---> **Ctrl

Here is my aproach

<a href="https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-6QVcVWXBRt0/WCxoy_1IrwI/AAAAAAAAGvA/snsOgGgN_tY_UgJUhB5aSQnvKXpOjHOmgCLcB/s1600/export.png&#39;;return true;">



 

El martes, 15 de noviembre de 2016, 17:21:29 (UTC-5), Jack Burridge escribió:

I had a quick look, but before spending time learning the WHOLE frame work is it possible to do things such as this:


<a href="https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png" style="margin-left:1em;margin-right:1em" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-hI7iF8ZleU0/WCuJtAgmxpI/AAAAAAAAAUA/qSYd8lexxpYUp_YxLwI6_7HjAkcNVty-ACLcB/s1600/Screenshot%2B-%2B151116%2B-%2B22%253A15%253A38.png&#39;;return true;">


This has the ability to add the two spinners as they change. The source is here <a href="https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch%2Fblob%2Fmultiwatch%2Fexample%2Fexample06.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHD2qgHcp80tCR0mnquwtKriFUAHw&#39;;return true;">https://github.com/jackburridge/pywatch/blob/multiwatch/example/example06.py

If dabo can do stuff like this easily that would be great

On Tuesday, 15 November 2016 18:54:39 UTC, johnf wrote:
have you looked at Dabo? <a href="http://www.dabodev.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.dabodev.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHmOjM0qZEqXJUUNrsM0lTT2hj89Q&#39;;return true;">www.dabodev.com

On Tue, Nov 15, 2016 at 9:23 AM, Jack Burridge <[hidden email]> wrote:
Hi Guys/Girls

I recently created a module to easily bind data to a wxpython GUI (<a href="https://github.com/jackburridge/pywatch" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjackburridge%2Fpywatch\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaB_3PLQA08bYHchut3Bx9AETsuw&#39;;return true;">https://github.com/jackburridge/pywatch) its far from complete but I thought I'd show it to you people for options etc.

The idea is that you have a root object that is watchable, pywatch gives you the object WatchableDict, this is meant to emulate the kind of behaviour you would see in AngularJS with $scope objects. You can then use classes within the submodule pywatch.wx to bind a property of this object to widgets within your GUI for example in the simple frame bellow:

class MyFrame(wx.Frame):
   
def __init__(self, parent):
        wx
.Frame.__init__(self, parent, title=u"My Frame")


       
self.model = WatchableDict()
       
self.model["text"] = ""


        sizer
= wx.BoxSizer(wx.VERTICAL)


       
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.text_ctrl, 0, 0, 0)
        pywatch
.wx.TextCtrlWatcher(self.text_ctrl,self.model,"text")


       
self.static_text = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
        sizer
.Add(self.static_text, 0, 0, 0)
        pywatch
.wx.LabelWatcher(self.static_text, self.model, ["text"])


       
self.SetSizer(sizer)


       
self.Centre(wx.BOTH)

When ever the text within text_ctrl is changed the text within static_text is automatically changed.

If anyone has any ideas on how I could improve this module, that would be great :)

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Michael Salin
In reply to this post by Jack Burridge

I think you have to exploit wx.propgrid as a GUI part in your SDK. It helps to display a lot of data in a column and it looks nice.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
I did it, but I want to have an oppinion about the library in order to know if it is good enough to be uploaded. Also it would be nice to combined both projects.


El miércoles, 16 de noviembre de 2016, 21:52:43 (UTC-5), Michael Salin escribió:

I think you have to exploit wx.propgrid as a GUI part in your SDK. It helps to display a lot of data in a column and it looks nice.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge
I definitely like your opinion on a single type of watcher but I would do it for things like enable, value, selection, etc
 

On Thursday, 17 November 2016 10:40:05 UTC, sebastian lópez wrote:
I did it, but I want to have an oppinion about the library in order to know if it is good enough to be uploaded. Also it would be nice to combined both projects.


El miércoles, 16 de noviembre de 2016, 21:52:43 (UTC-5), Michael Salin escribió:

I think you have to exploit wx.propgrid as a GUI part in your SDK. It helps to display a lot of data in a column and it looks nice.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge
In reply to this post by Michael Salin
Yeah my idea was to move onto that, but two little questions
1. How would you sort the dict, i was thinking a key would be nice
2. would you base the type on the current type, for example in the dict
{"text":"string","number":0,"bool":True}
and infer it or:
{"text":{"type":str,"value":"string"},"number":{"type":int,"min":0,"max":10},"bool":{"type":bool,"value":True}}

On Thursday, 17 November 2016 02:52:43 UTC, Michael Salin wrote:

I think you have to exploit wx.propgrid as a GUI part in your SDK. It helps to display a lot of data in a column and it looks nice.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by Jack Burridge
Hello. When I was developing the easyDialog library I attemp to create a fubctuion that identify the type control and then use an appropiated method, but when you added a new control or a custom control then you have to update It. So I preffer to be moved into a new type of CtrlBase that had a generic property Value, in the case you have a textCtrl the Value return a string in the other hand if you used a listCtrl the Value method return a string with the selected ítem and so on.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
In reply to this post by Jack Burridge
Hello. When I was developing the easyDialog library I attemp to create a fubctuion that identify the control type and and then use an appropiated method, but when you added a new control or a custom control then you have to update It. So I preffer to be moved into a new type of CtrlBase that had a generic property Value, in the case you have a textCtrl the Value return a string in the other hand if you used a listCtrl the Value method return a string with the selected ítem and so on.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge
Ahh! Something like this:

value_events = {
    wx.SpinCtrl: wx.EVT_SPIN,
    wx.Slider: wx.EVT_SLIDER,
    wx.CheckBox: wx.EVT_CHECKBOX,
    wx.ToggleButton: wx.EVT_TOGGLEBUTTON,
    wx.TextCtrl: wx.EVT_TEXT
}


class ValueChanger(ValueWatcher):
    def __init__(self, widget, watchable, watcher):
        event = [value_events[widget_class] for widget_class in value_events if isinstance(widget,widget_class)]
        if not event:
            raise Exception('Widget type is not recognised')
        ValueWatcher.__init__(self, widget, watchable, watcher)
        widget.Bind(event[0], self.on_change)

    def on_change(self, event):
        self.set_value(self.widget.GetValue())
        event.Skip()


On Friday, 18 November 2016 13:36:38 UTC, sebastian lópez wrote:
Hello. When I was developing the easyDialog library I attemp to create a fubctuion that identify the control type and and then use an appropiated method, but when you added a new control or a custom control then you have to update It. So I preffer to be moved into a new type of CtrlBase that had a generic property Value, in the case you have a textCtrl the Value return a string in the other hand if you used a listCtrl the Value method return a string with the selected ítem and so on.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

sebastian lópez
It looks better

Now I'm finish to make some fixes to share my code.

About that i would  like to share you the code I used to create this GUI

from easyDialog import Ctrl
from Modulos.coreMod import _BasePanel
from imagenes import imageEmbed
import wx
_ = wx.GetTranslation
imag= imageEmbed(size=(16, 16))
class Panel(_BasePanel):
    name = _('FOR-MAN-001')# formato de mantenimiento
    image = imag.dashboard
    def __init__(self, parent, id = wx.ID_ANY, *args, **kwargs):
        _BasePanel.__init__(self, parent, id, *args, **kwargs)
        mp, st, tc, bm = Ctrl.MakePairs, Ctrl.StaticText, Ctrl.TextCtrl, Ctrl.BitmapButton
        sb, spa, flex, grid = Ctrl.StaticBitmap, Ctrl.Spacer, Ctrl.FlexGridSizer, Ctrl.GridSizer
        imag = imageEmbed(size=(590, 80))
        header = mp([sb(imag.formulario),
                    mp([st('Especificaciones')], horzCenter=True),
                    ],
                    horz=wx.VERTICAL,
                    flag=wx.EXPAND|wx.ALL)
        flexi = flex([st('Año del modelo'), st('Odómetro'),
                     Ctrl.IntTextCtrl('2016').tooltip(_('Año de fabricación')), 
                     mp([tc(size=(125,-1)).tooltip(_('Valor inicial\ndel odómetro')),
                         Ctrl.Choice(['Kilometros','Millas'],0)],
                        border=0),
                     st('Fabricante'), st('Placa'),
                     tc('').tooltip(_('Del vehículo')),
                     tc('', size=wx.Size(210, -1)).tooltip(_('Número de la\nplaca del automotor')),
                     st('Modelo'), st('Código'),
                     tc('').tooltip(_('Modelo acorde\ncon el fabricante')),
                     tc('', size=wx.Size(210, -1)).tooltip(_('Que se le asignará\nen la empresa para\nidentificarlo')),
                     st('Color'), st('Conductor'),
                     tc('Negro').tooltip(_('Color actual')),
                     Ctrl.User().tooltip(_('Seleccione un usuario\nRegistrado en la base')),
                     ], 2)
        body_left = mp([flexi],
                  proportion=0,
                  horzCenter=True,
                  title= _('Información del vehículo'),
                  flag=wx.ALL,
                  )
        imag = imageEmbed(size=(200, 200))
        body_rigth = mp([sb(imag.equipo)], title=_('Imágen del vehículo'), flag=wx.ALL|wx.EXPAND)
        body = mp([body_left,  body_rigth], flag=wx.ALL|wx.EXPAND, horzCenter=True)
        
        body_midle_top = mp([flex([st(_('Numero de Tarjeta')),
                                 tc(size=wx.Size(117,-1)).tooltip(_('Tarjete de operación')),
                                 st(_('Fecha de vencimiento')), Ctrl.DatePickerCtrl(size=wx.Size(117, -1)),
                                 ],2)],
                            horz=wx.VERTICAL, flag=wx.EXPAND, title=_('Licencia'))
        body_midle_bottom = mp([flex([st(_('Empresa/compañía')),
                                     tc(size=wx.Size(125,-1)).tooltip(_('Empresa que aseguró\nel vehículo')),
                                    st(_('Número de\nla cuenta')),
                                    tc(size=wx.Size(125,-1)).tooltip(_('O el número\ndel seguro')),
                                    st(_('Fecha Vencimiento')),
                                    Ctrl.DatePickerCtrl(size=wx.Size(125,-1)).\
                                        tooltip(_('Fecha de vencimiento\ndel seguro')),
                                    ],2)
                                ],
                                title=_('Aseguradora'))
        body_midle_left = mp([body_midle_top, body_midle_bottom], horz=wx.VERTICAL, flag=wx.EXPAND)
        
        body_mid_rigtop = mp([flex([st(_('Motor')),
                                   tc(size=wx.Size(205,-1)).tooltip(_('cm cúbicos\nnúmero de válvulas')),
                                   st(_('Transmisión')),
                                   Ctrl.Choice(['Mecánica', 'Automática'],0, size=wx.Size(205,-1)).\
                                        tooltip(_('tipo de transmisión\ndel vehículo')),
                                   st(_('Tamaño de\nla llanta')),
                                   tc(size=wx.Size(205,-1)),
                                   ],2)
                             ],
                             title=_('Mecanica'))
        body_mid_rigbottom = mp([tc(style=wx.TE_MULTILINE,size=wx.Size(290, 56)).\
                                   tooltip(_('Observaciones con respecto\nal vehículo'))],
                                flag=wx.EXPAND|wx.ALL, title=_('Observaciones'))
        body_midle_rigth = mp([body_mid_rigtop, body_mid_rigbottom], horz=wx.VERTICAL, flag=wx.EXPAND)
        body_midle = mp([body_midle_left, body_midle_rigth], flag=wx.ALL, horzCenter=True)
        main_sizer = mp([header, body, body_midle],
                  title=_('Datos básicos'),
                  horzCenter=True,
                  horz=wx.VERTICAL)
        self.Sizer= main_sizer
pnl= Panel(ntb)
ntb.AddPage(pnl, pnl.name, True)
wx.MessageBox('{}'.format(pnl.Value))

I hope It's not too complicated, but you have to consider to obtain Its values you just have to use the command

>>> pnl.Value

In the other hand you can also use it to set the GUI values.

>>> pnl.Value = ['some list of values',dateObject,'',...,]


It would be nice to hear an expert opinion.



El viernes, 18 de noviembre de 2016, 12:24:46 (UTC-5), Jack Burridge escribió:
Ahh! Something like this:

value_events = {
    wx.SpinCtrl: wx.EVT_SPIN,
    wx.Slider: wx.EVT_SLIDER,
    wx.CheckBox: wx.EVT_CHECKBOX,
    wx.ToggleButton: wx.EVT_TOGGLEBUTTON,
    wx.TextCtrl: wx.EVT_TEXT
}


class ValueChanger(ValueWatcher):
    def __init__(self, widget, watchable, watcher):
        event = [value_events[widget_class] for widget_class in value_events if isinstance(widget,widget_class)]
        if not event:
            raise Exception('Widget type is not recognised')
        ValueWatcher.__init__(self, widget, watchable, watcher)
        widget.Bind(event[0], self.on_change)

    def on_change(self, event):
        self.set_value(self.widget.GetValue())
        event.Skip()


On Friday, 18 November 2016 13:36:38 UTC, sebastian lópez wrote:
Hello. When I was developing the easyDialog library I attemp to create a fubctuion that identify the control type and and then use an appropiated method, but when you added a new control or a custom control then you have to update It. So I preffer to be moved into a new type of CtrlBase that had a generic property Value, in the case you have a textCtrl the Value return a string in the other hand if you used a listCtrl the Value method return a string with the selected ítem and so on.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Opinion on new library

Jack Burridge
It doesn't look to complicated but it is inherently hard to read

On Tuesday, 22 November 2016 03:04:14 UTC, sebastian lópez wrote:
It looks better

Now I'm finish to make some fixes to share my code.

About that i would  like to share you the code I used to create this GUI

<a href="https://lh3.googleusercontent.com/-jt4sCl9N_Bs/WDO0OcbUTJI/AAAAAAAAGv8/PPeXOyVMrRc0P_-LCV3MpDCJWXRrn2pWgCLcB/s1600/User%2BInterfase.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-jt4sCl9N_Bs/WDO0OcbUTJI/AAAAAAAAGv8/PPeXOyVMrRc0P_-LCV3MpDCJWXRrn2pWgCLcB/s1600/User%2BInterfase.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-jt4sCl9N_Bs/WDO0OcbUTJI/AAAAAAAAGv8/PPeXOyVMrRc0P_-LCV3MpDCJWXRrn2pWgCLcB/s1600/User%2BInterfase.png&#39;;return true;">

from easyDialog import Ctrl
from Modulos.coreMod import _BasePanel
from imagenes import imageEmbed
import wx
_ = wx.GetTranslation
imag= imageEmbed(size=(16, 16))
class Panel(_BasePanel):
    name = _('FOR-MAN-001')# formato de mantenimiento
    image = imag.dashboard
    def __init__(self, parent, id = wx.ID_ANY, *args, **kwargs):
        _BasePanel.__init__(self, parent, id, *args, **kwargs)
        mp, st, tc, bm = Ctrl.MakePairs, Ctrl.StaticText, Ctrl.TextCtrl, Ctrl.BitmapButton
        sb, spa, flex, grid = Ctrl.StaticBitmap, Ctrl.Spacer, Ctrl.FlexGridSizer, Ctrl.GridSizer
        imag = imageEmbed(size=(590, 80))
        header = mp([sb(imag.formulario),
                    mp([st('Especificaciones')], horzCenter=True),
                    ],
                    horz=wx.VERTICAL,
                    flag=wx.EXPAND|wx.ALL)
        flexi = flex([st('Año del modelo'), st('Odómetro'),
                     Ctrl.IntTextCtrl('2016').tooltip(_('Año de fabricación')), 
                     mp([tc(size=(125,-1)).tooltip(_('Valor inicial\ndel odómetro')),
                         Ctrl.Choice(['Kilometros','Millas'],0)],
                        border=0),
                     st('Fabricante'), st('Placa'),
                     tc('').tooltip(_('Del vehículo')),
                     tc('', size=wx.Size(210, -1)).tooltip(_('Número de la\nplaca del automotor')),
                     st('Modelo'), st('Código'),
                     tc('').tooltip(_('Modelo acorde\ncon el fabricante')),
                     tc('', size=wx.Size(210, -1)).tooltip(_('Que se le asignará\nen la empresa para\nidentificarlo')),
                     st('Color'), st('Conductor'),
                     tc('Negro').tooltip(_('Color actual')),
                     Ctrl.User().tooltip(_('Seleccione un usuario\nRegistrado en la base')),
                     ], 2)
        body_left = mp([flexi],
                  proportion=0,
                  horzCenter=True,
                  title= _('Información del vehículo'),
                  flag=wx.ALL,
                  )
        imag = imageEmbed(size=(200, 200))
        body_rigth = mp([sb(imag.equipo)], title=_('Imágen del vehículo'), flag=wx.ALL|wx.EXPAND)
        body = mp([body_left,  body_rigth], flag=wx.ALL|wx.EXPAND, horzCenter=True)
        
        body_midle_top = mp([flex([st(_('Numero de Tarjeta')),
                                 tc(size=wx.Size(117,-1)).tooltip(_('Tarjete de operación')),
                                 st(_('Fecha de vencimiento')), Ctrl.DatePickerCtrl(size=wx.Size(117, -1)),
                                 ],2)],
                            horz=wx.VERTICAL, flag=wx.EXPAND, title=_('Licencia'))
        body_midle_bottom = mp([flex([st(_('Empresa/compañía')),
                                     tc(size=wx.Size(125,-1)).tooltip(_('Empresa que aseguró\nel vehículo')),
                                    st(_('Número de\nla cuenta')),
                                    tc(size=wx.Size(125,-1)).tooltip(_('O el número\ndel seguro')),
                                    st(_('Fecha Vencimiento')),
                                    Ctrl.DatePickerCtrl(size=wx.Size(125,-1)).\
                                        tooltip(_('Fecha de vencimiento\ndel seguro')),
                                    ],2)
                                ],
                                title=_('Aseguradora'))
        body_midle_left = mp([body_midle_top, body_midle_bottom], horz=wx.VERTICAL, flag=wx.EXPAND)
        
        body_mid_rigtop = mp([flex([st(_('Motor')),
                                   tc(size=wx.Size(205,-1)).tooltip(_('cm cúbicos\nnúmero de válvulas')),
                                   st(_('Transmisión')),
                                   Ctrl.Choice(['Mecánica', 'Automática'],0, size=wx.Size(205,-1)).\
                                        tooltip(_('tipo de transmisión\ndel vehículo')),
                                   st(_('Tamaño de\nla llanta')),
                                   tc(size=wx.Size(205,-1)),
                                   ],2)
                             ],
                             title=_('Mecanica'))
        body_mid_rigbottom = mp([tc(style=wx.TE_MULTILINE,size=wx.Size(290, 56)).\
                                   tooltip(_('Observaciones con respecto\nal vehículo'))],
                                flag=wx.EXPAND|wx.ALL, title=_('Observaciones'))
        body_midle_rigth = mp([body_mid_rigtop, body_mid_rigbottom], horz=wx.VERTICAL, flag=wx.EXPAND)
        body_midle = mp([body_midle_left, body_midle_rigth], flag=wx.ALL, horzCenter=True)
        main_sizer = mp([header, body, body_midle],
                  title=_('Datos básicos'),
                  horzCenter=True,
                  horz=wx.VERTICAL)
        self.Sizer= main_sizer
pnl= Panel(ntb)
ntb.AddPage(pnl, <a href="http://pnl.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fpnl.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFXMGihWtkP3uqrTY8QrRv6tJKx9g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fpnl.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFXMGihWtkP3uqrTY8QrRv6tJKx9g&#39;;return true;">pnl.name, True)
wx.MessageBox('{}'.format(pnl.Value))

I hope It's not too complicated, but you have to consider to obtain Its values you just have to use the command

>>> pnl.Value

In the other hand you can also use it to set the GUI values.

>>> pnl.Value = ['some list of values',dateObject,'',...,]

<a href="https://lh3.googleusercontent.com/-9YN3-jSzojQ/WDO05s8VqOI/AAAAAAAAGwA/pEqcESkU6wUeRJ38OpHua7JOFTmPH4y3wCLcB/s1600/getting%2Bthe%2Bvalues.png" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-9YN3-jSzojQ/WDO05s8VqOI/AAAAAAAAGwA/pEqcESkU6wUeRJ38OpHua7JOFTmPH4y3wCLcB/s1600/getting%2Bthe%2Bvalues.png&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-9YN3-jSzojQ/WDO05s8VqOI/AAAAAAAAGwA/pEqcESkU6wUeRJ38OpHua7JOFTmPH4y3wCLcB/s1600/getting%2Bthe%2Bvalues.png&#39;;return true;">


It would be nice to hear an expert opinion.



El viernes, 18 de noviembre de 2016, 12:24:46 (UTC-5), Jack Burridge escribió:
Ahh! Something like this:

value_events = {
    wx.SpinCtrl: wx.EVT_SPIN,
    wx.Slider: wx.EVT_SLIDER,
    wx.CheckBox: wx.EVT_CHECKBOX,
    wx.ToggleButton: wx.EVT_TOGGLEBUTTON,
    wx.TextCtrl: wx.EVT_TEXT
}


class ValueChanger(ValueWatcher):
    def __init__(self, widget, watchable, watcher):
        event = [value_events[widget_class] for widget_class in value_events if isinstance(widget,widget_class)]
        if not event:
            raise Exception('Widget type is not recognised')
        ValueWatcher.__init__(self, widget, watchable, watcher)
        widget.Bind(event[0], self.on_change)

    def on_change(self, event):
        self.set_value(self.widget.GetValue())
        event.Skip()


On Friday, 18 November 2016 13:36:38 UTC, sebastian lópez wrote:
Hello. When I was developing the easyDialog library I attemp to create a fubctuion that identify the control type and and then use an appropiated method, but when you added a new control or a custom control then you have to update It. So I preffer to be moved into a new type of CtrlBase that had a generic property Value, in the case you have a textCtrl the Value return a string in the other hand if you used a listCtrl the Value method return a string with the selected ítem and so on.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
12