title: ArgumentError: argument 3: <class 'TypeError'>: wrong type
body: <p>I'm testing kivy on win10 via nimiconda.</p>
  
  <p>Everytime when I run(press F5 on miniconda,the same as anaconda) the kivy code for the second time,the consel will throw "ArgumentError: argument 3: : wrong type"</p>
  
  <p>I test the kivy code by Miniconda3(also test it in Anaconda3,the same issus appeard),Every time I press F5 for the first time, the code runs normally,and kivy interface appears normally, as follow:</p>
  
  <pre><code>runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')
  
  [INFO   ] [Logger      ] Record log in C:\Users\38477\.kivy\logs\kivy_19-07-20_1.txt
  [INFO   ] [Kivy        ] v1.11.1
  [INFO   ] [Kivy        ] Installed at "G:\Miniconda3\lib\site-packages\kivy\__init__.py"
  [INFO   ] [Python      ] v3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
  [INFO   ] [Python      ] Interpreter at "G:\Miniconda3\pythonw.exe"
  [INFO   ] [Factory     ] 184 symbols loaded
  [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
  [INFO   ] [Text        ] Provider: sdl2
  [INFO   ] [Window      ] Provider: sdl2
  [INFO   ] [GL          ] Using the "OpenGL" graphics system
  [INFO   ] [GL          ] GLEW initialization succeeded
  [INFO   ] [GL          ] Backend used &lt;glew&gt;
  [INFO   ] [GL          ] OpenGL version &lt;b'4.0.0 - Build 10.18.10.4885'&gt;
  [INFO   ] [GL          ] OpenGL vendor &lt;b'Intel'&gt;
  [INFO   ] [GL          ] OpenGL renderer &lt;b'Intel(R) HD Graphics 4000'&gt;
  [INFO   ] [GL          ] OpenGL parsed version: 4, 0
  [INFO   ] [GL          ] Shading version &lt;b'4.00 - Build 10.18.10.4885'&gt;
  [INFO   ] [GL          ] Texture max size &lt;16384&gt;
  [INFO   ] [GL          ] Texture max units &lt;16&gt;
  [INFO   ] [Window      ] auto add sdl2 input provider
  [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
  [INFO   ] [Base        ] Start application main loop
  [INFO   ] [GL          ] NPOT texture support is available
  [INFO   ] [WindowSDL   ] exiting mainloop and closing.
  [INFO   ] [Base        ] Leaving application in progress...
  </code></pre>
  
  <p>but after colsing kivy interface ,pressing F5 will report the following error.</p>
  
  <pre><code>runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')
  [INFO   ] [Base        ] Start application main loop
  [ERROR  ] [Base        ] No event listeners have been created
  [ERROR  ] [Base        ] Application will leave
  [INFO   ] [Base        ] Leaving application in progress...
  [INFO   ] [Base        ] Leaving application in progress...
  Traceback (most recent call last):
  
  File "&lt;ipython-input-2-83710e3ec7f9&gt;", line 1, in &lt;module&gt;
  runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')
  
  File"G:\Miniconda3\lib\sitepackages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
     execfile(filename, namespace)
  
  File "G:\Miniconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
  exec(compile(f.read(), filename, 'exec'), namespace)
  
   File "C:/Users/38477/.spyder-py3/temp.py", line 15, in &lt;module&gt;
     TestApp().run()
  
   File "G:\Miniconda3\lib\site-packages\kivy\app.py", line 855, in run
     runTouchApp()
  
   File "G:\Miniconda3\lib\site-packages\kivy\base.py", line 506, in runTouchApp
     stopTouchApp()
  
   File "G:\Miniconda3\lib\site-packages\kivy\base.py", line 521, in stopTouchApp
     EventLoop.close()
  
   File "G:\Miniconda3\lib\site-packages\kivy\base.py", line 172, in close
     self.stop()
  
   File "G:\Miniconda3\lib\site-packages\kivy\base.py", line 184, in stop
     provider.stop()
  
   File "G:\Miniconda3\lib\site-packages\kivy\input\providers\wm_pen.py", line 111, in stop
     SetWindowLong_WndProc_wrapper(self.hwnd, self.old_windProc)
  
   File "G:\Miniconda3\lib\site-packages\kivy\input\providers\wm_common.py", line 122, in _closure
     oldAddr = func(hWnd, GWL_WNDPROC, cast(wndProc, c_void_p).value)
  
  ArgumentError: argument 3: &lt;class 'TypeError'&gt;: wrong type
  </code></pre>
  
  <p>here is the test code I got from <a href="https://kivy.org/#home" rel="nofollow noreferrer">https://kivy.org/#home</a></p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.button import Button
  
  class TestApp(App):
      def build(self):
          return Button(text='Hello World')
  
  TestApp().run()
  </code></pre>
  
  <p>Restart the kernel is a feasible method, but this means that I must restart the kernel every time after runing the code. Is is normal?</p>
  
  <p><strong>Environment</strong></p>
  
  <pre><code>active environment : base
  active env location : G:\Miniconda3
  shell level : 1
  user config file : C:\Users\38477\.condarc
  populated config files :
  conda version : 4.7.9
  conda-build version : not installed
  python version : 3.7.3.final.0
  virtual packages : __cuda=9.1
  base environment : G:\Miniconda3  (writable)
             channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                            https://repo.anaconda.com/pkgs/main/noarch
                            https://repo.anaconda.com/pkgs/r/win-64
                            https://repo.anaconda.com/pkgs/r/noarch
                            https://repo.anaconda.com/pkgs/msys2/win-64
                            https://repo.anaconda.com/pkgs/msys2/noarch
   package cache : G:\Miniconda3\pkgs
                             C:\Users\38477\.conda\pkgs
                            C:\Users\38477\AppData\Local\conda\conda\pkgs
         envs directories : G:\Miniconda3\envs
                            C:\Users\38477\.conda\envs
                            C:\Users\38477\AppData\Local\conda\conda\envs
  platform : win-64
  user-agent : conda/4.7.9 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17134
  administrator : False
  netrc file : None
  offline mode : False
  </code></pre>