Re: problem with DatePickerCtrl

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

zylyco
I'm not really working with a lot of python lately but I did run your code and confirmed the issue.  In fact if you run the wxPython demo you can see the issue on Linux.  I have been using a package 'Dabo' for a long time and it does have a replacement for the date control.  If you are in immediate need you might want to download and extract  dTextBox.py and dDateTextBox.py from the package.  I can confirm that the files work on all platforms supported by wxPython.  You will have to extract much of the code to get it to work with plain wxPython but I know it can be done.

Hi John and thank you.

I installed Dabo with PIP.
Then I tried to do the following :

For some quick results for the impatient, once you've installed Dabo using the standard python setup.py install method, do this from your Python interpreter:

from dabo.dApp import dApp
dApp().start()

press Ctrl+D and type the following into the command window that appears:

tb = dabo.ui.dTextBox(self)

Notice the textbox in the upper left hand corner?

tb.Value = "yippee!"
tb.FontBold = True
print tb.Value
But, as soon as I do the " dApp().start() " command, I've got this error :

>>> dApp().start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/dabo/dApp.py", line 388, in start
    self.setup()
  File "/usr/lib64/python2.7/site-packages/dabo/dApp.py", line 340, in setup
    self.initUIApp()
  File "/usr/lib64/python2.7/site-packages/dabo/dApp.py", line 380, in initUIApp
    self.uiApp.setup()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/uiApp.py", line 435, in setup
    frm = self.dApp.MainForm = mfc()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dFormMain.py", line 50, in __init__
    dFormMainBase.__init__(self, preClass, parent, properties, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dFormMain.py", line 11, in __init__
    fm.dFormMixin.__init__(self, preClass, parent, properties, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dFormMixin.py", line 76, in __init__
    attProperties=attProperties, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__
    self._afterInit()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dFormMixin.py", line 96, in _afterInit
    self.MenuBar = mbc()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenuBar.py", line 21, in __init__
    pm.dPemMixin.__init__(self, preClass, None, properties, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__
    self._afterInit()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dBaseMenuBar.py", line 184, in _afterInit
    self.fileMenu = self.appendMenu(FileMenu(self, MenuID="base_file"))
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dBaseMenuBar.py", line 26, in __init__
    super(FileMenu, self).__init__(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenu.py", line 47, in __init__
    attProperties=attProperties, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dPemMixin.py", line 202, in __init__
    self._afterInit()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dBaseMenuBar.py", line 43, in _afterInit
    help=_("Open up a debug output window"))
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenu.py", line 255, in append
    menutype=menutype, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenu.py", line 238, in _createMenuItem
    item = _actualCreation(caption, help, picture, menutype, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenu.py", line 232, in _actualCreation
    _item.Caption = caption
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenuItem.py", line 95, in _setCaption
    self._redefine()
  File "/usr/lib64/python2.7/site-packages/dabo/ui/uiwx/dMenuItem.py", line 72, in _redefine
    self.SetBitmap(self.Icon)
  File "/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line 12543, in SetBitmap
    return _core_.MenuItem_SetBitmap(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ./src/gtk/menu.cpp(724) in SetBitmap(): only normal menu items can have bitmaps
>>>
I have to search what cause this issue.
I'll do it later.

But if you have any idea of what's going wrong, it would be great.

Anyway, I'll advise you of my progress.

--
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
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

Dietmar Schwertberger-2
In reply to this post by zylyco
On 6/17/17 7:02 PM, [hidden email] wrote:
> I tried others events like EVT_KEY_DOWN or EVT_KEY_UP, but on Linux
> they seem not working at all.
> I noticed that EVT_CHAR is detected in the datepickerctrl widget : the
> ENTER / UP / DOWN keys are recognized, but not at all the TAB one...
>
> I'll do some more tests later.
> I'll post the results as well.
Try EVT_CHAR_HOOK as well.

Regards,
Dietmar

--
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
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

zylyco

On 6/17/17 7:02 PM, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="RCSmq3ZHAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">zyl...@... wrote:
> I tried others events like EVT_KEY_DOWN or EVT_KEY_UP, but on Linux
> they seem not working at all.
> I noticed that EVT_CHAR is detected in the datepickerctrl widget : the
> ENTER / UP / DOWN keys are recognized, but not at all the TAB one...
>
> I'll do some more tests later.
> I'll post the results as well.
Try EVT_CHAR_HOOK as well.

Hi,

I tried EVT_CHAR_HOOK with the datepickerctrl, but a new weird behaviour happens :
- there are 3 widgets : 1 datepickerctrl, and 2 textctrl
- if I press "Tab" key in the datepickerctrl, the focus jumps directly on the 2nd textctrl : it doesn't stop on the first textctrl, so behaviour "weird"
- if I enter a valid date between years 1800 / 2200, the same command " self.text_ctrl_value_1.SetFocus() " : jumps to the 1rst textctrl, so desired behaviour

I joined the python code to show this problem.

What do you think ?

Thanks a lot.

--
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.

test-char_hook.py (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

Dietmar Schwertberger-2
On 6/23/17 3:58 PM, [hidden email] wrote:
> I tried EVT_CHAR_HOOK with the datepickerctrl, but a new weird
> behaviour happens :
> - there are 3 widgets : 1 datepickerctrl, and 2 textctrl
> - if I press "Tab" key in the datepickerctrl, the focus jumps directly
> on the 2nd textctrl : it doesn't stop on the first textctrl, so
> behaviour "weird"
> - if I enter a valid date between years 1800 / 2200, the same command
> " self.text_ctrl_value_1.SetFocus() " : jumps to the 1rst textctrl, so
> desired behaviour
You're almost done.
Just move event.Skip() to an else clause in your handler such that it
does not get called if you handle the Tab key yourself:
         if event.GetKeyCode() == wx.WXK_TAB :
             print "Tab key pressed in DatePickerCtrl..."
             self.text_ctrl_value_1.SetFocus()
         else:
             event.Skip()

With the Skip() the EVT_CHAR_HOOK gets propagated to the window. So you
set the focus to the first text control, the window receives the Tab and
moves on the focus to the second control.

Regards,
Dietmar

--
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
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

zylyco
On 6/23/17 3:58 PM, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="kJz1qWJJAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">zyl...@... wrote:
> I tried EVT_CHAR_HOOK with the datepickerctrl, but a new weird
> behaviour happens :
> - there are 3 widgets : 1 datepickerctrl, and 2 textctrl
> - if I press "Tab" key in the datepickerctrl, the focus jumps directly
> on the 2nd textctrl : it doesn't stop on the first textctrl, so
> behaviour "weird"
> - if I enter a valid date between years 1800 / 2200, the same command
> " self.text_ctrl_value_1.SetFocus() " : jumps to the 1rst textctrl, so
> desired behaviour
You're almost done.
Just move event.Skip() to an else clause in your handler such that it
does not get called if you handle the Tab key yourself:
         if event.GetKeyCode() == wx.WXK_TAB :
             print "Tab key pressed in DatePickerCtrl..."
             self.text_ctrl_value_1.SetFocus()
         else:
             event.Skip()

With the Skip() the EVT_CHAR_HOOK gets propagated to the window. So you
set the focus to the first text control, the window receives the Tab and
moves on the focus to the second control.

Thanks a lot Dietmar,
it works as expected.

--
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
|  
Report Content as Inappropriate

Re: problem with DatePickerCtrl

zylyco
In reply to this post by zylyco
Are you using Linux?
What is you GTK+ version?

Did you try Windows/OSX as well?
Could you search if it is a known issue on <a href="http://trac.wxwidgets.org" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExQNhI0mYZSFIGuOEJc_Mjo_rflg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExQNhI0mYZSFIGuOEJc_Mjo_rflg&#39;;return true;">trac.wxwidgets.org?

Thank you.


My software with wxPython/DatePickerCtrl runs as expected on Windows :
inside the widget, I press " Tab " key, on the "focus" jumps to the next widget.

But on each Linux system I tried (Ubuntu, openSuse, Fedora, Mint, MageIA, CentOS, Debian), in case I used the packages provides for wxPython, but as well if I've installed it from sources :
when the " focus " is inside the DatePickerCtrl, the " Tab " Key used to "jump" to the next Widget is not working... I'm blocked inside the DatePickerCtrl, and the only way to move from here, is to use the mouse to select the next widget...

I don't have tried on OSx, because I don't use it, so I don't know for this system.

On each of my Linux systems, I have :
Python 2.7.x
wxGTK 3.0.2
wxPython 3.0.2.0

I repeat, on Windows7/8/10, I don't have any kind of problem with this Widget, it works fine.

But I've noticed this behaviour on all the Linux systems I'm using...

I checked on <a href="http://trac.wxwidgets.org" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExQNhI0mYZSFIGuOEJc_Mjo_rflg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNExQNhI0mYZSFIGuOEJc_Mjo_rflg&#39;;return true;">trac.wxwidgets.org an found :
<a href="http://trac.wxwidgets.org/ticket/11630" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org%2Fticket%2F11630\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHx04Oz4qpO41gSVgQhDc3eLKaNWA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Ftrac.wxwidgets.org%2Fticket%2F11630\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHx04Oz4qpO41gSVgQhDc3eLKaNWA&#39;;return true;">http://trac.wxwidgets.org/ticket/11630
I'll post there a message tomorrow to report the issue again.


My reports post on :
http://trac.wxwidgets.org/ticket/11630#comment:17
haven't encountered much success...

But my problem is solved, thanks to you, and specialy to Dietmar's suggestions.

I just wanted to point at the distinct datepickerctrl 's behaviour on Windows and Linux.

--
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
Loading...