input type=file in simple html2 webView

Hi,

I am new to wxPython and just wanted to create a really simple webview that allows for uploading of a file using an HTML tag. But it never pops up the file dialog for me to upload like it does in a browser.

Can anyone point me in the right direction? Note I want to keep it as a webview for now so I can use the same code for a standard web upload.

Code I am using is:

***HTML

Upload new File

Upload new File

<form action="" method=post enctype=multipart/form-data>

  <p>Title <input type=text name=title></p>

  <p>Description <input type=text name=description></p>

  <p>Category <select name=category>

		<option value=""></option>

	<li><em>Unbelievable.  No entries here so far</em>

</select>
  <p>Source <select name=source>

		<option value=""></option>

	<li><em>Unbelievable.  No entries here so far</em>

</select>
  <p><input type=file name=file>

     <input type=submit value=Upload>

***Python

import wx

import wx.html2

class MyBrowser(wx.Dialog):

def init(self, *args, **kwds):

wx.Dialog.init(self, *args, **kwds)

sizer = wx.BoxSizer(wx.VERTICAL)

self.browser = wx.html2.WebView.New(self)

sizer.Add(self.browser, 1, wx.EXPAND, 10)

self.SetSizer(sizer)

self.SetSize((700, 700))

if name == ‘main’:

app2 = wx.App()

dialog = MyBrowser(None, -1)

dialog.browser.LoadURL(“http://localhost:9005/”)

dialog.Show()

app2.MainLoop()

First try with well formed html - every

should have a
matching

, every
  • should have a
  • ,

  • s should only occur within a
      ...
    or
      ...
    block and most of all. Then you might have a hope of your code working.
    ···

    On 25/06/13 01:31, Andrew Sinclair
    wrote:

    Hi,

        I am new to wxPython and just wanted to create a really
    

    simple webview that allows for uploading of a file using an
    HTML tag. But it never pops up the file
    dialog for me to upload like it does in a browser.

        Can anyone point me in the right direction? Note I want to
    

    keep it as a webview for now so I can use the same code for a
    standard web upload.

    Code I am using is:

    ***HTML

    Upload new File

    Upload new File

    <form action="" method=post enctype=multipart/form-data>
    
      <p>Title <input type=text name=title></p>
    
      <p>Description <input type=text name=description></p>
    
      <p>Category <select name=category>
    
             <option value=""></option>
    
  • Unbelievable. No entries here so far
  •         </select>
    

      <p>Source <select name=source>
    
             <option value=""></option>
    
  • Unbelievable. No entries here so far
  •         </select>
    

      <p><input type=file name=file>
    
         <input type=submit value=Upload>
    

    ***Python

    import wx

    import wx.html2

    class MyBrowser(wx.Dialog):

    def
    init(self ,
    *args, **kwds):

    wx.Dialog.init(self, *args, **kwds)

    sizer = wx.BoxSizer(wx.VERTICAL)

    self .browser =
    wx.html2.WebView.New(self)

    sizer.Add(self .browser,
    1, wx.EXPAND ,
    10)

    self.SetSizer(sizer)

    self.SetSize((700, 700))

    if name == ‘main’:

    app2 = wx.App()

    dialog = MyBrowser(None, -1)

    dialog.browser.LoadURL()

    dialog.Show()

    app2.MainLoop()

      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 .
    For more options, visit .
    **
    must match a **

    "http://localhost:9005/"wxpython-users+unsubscribe@googlegroups.com
    https://groups.google.com/groups/opt_out

  • Andrew Sinclair wrote:

    I am new to wxPython and just wanted to create a really simple webview
    that allows for uploading of a file using an <input type=file> HTML
    tag. But it never pops up the file dialog for me to upload like it
    does in a browser.

    What package are you using to serve the web page? The HTML is mostly
    correct (except for the missing <html> tags, and that the <title> tag
    should be in a <head> section). It certainly works in Firefox.

    Does the Browse button do anything at all when you push it?

    ···

    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    I’m guessing you didn’t even read his code, because all his tags DO
    match.

    ···

    Steve Barnes wrote:

      First try with well formed html - every <p> should have a
    

    matching

    , every
  • should have a
  • ,

  • s should only occur within a
      ...
    or
      ...
    block and most of all** must match a **.
  • -- Tim Roberts, Providenza & Boekelheide, Inc.
    

    timr@probo.com

    Sorry Tim,
    I must have miss read it - ironically because of poor indentation
    and the final:

    ···

    On 25/06/13 18:18, Tim Roberts wrote:

      I'm guessing you didn't even read his code, because all his tags
    

    DO match.
    – 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 .
    For more options, visit .

      <p><input type=file name=file>
    
         <input type=submit value=Upload>
    
        where the <p> isn't terminated nor are the <input>
    

    even though they can and normally are of the for <input …
    />

    Steve

    Steve Barnes wrote:

        First try with well formed html - every <p> should have a
    

    matching

    , every
  • should have a
  • ,

  • s should only occur within a
      ...
    or
      ...
    block and most of all** must match a **.
  • -- Tim Roberts, Providenza & Boekelheide, Inc.
    

    timr@probo.com

    wxpython-users+unsubscribe@googlegroups.com
    https://groups.google.com/groups/opt_out