tkFileDialog.askdirectory root directory ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ringwraith

    tkFileDialog.askdirectory root directory ?

    Hello!

    I have the following problem. I use the tkFileDialog.as kdirectory dialog to
    allow users of my application to pick some subfolder from 'C:/my_app'
    directory. I use initialdir='C:/my_app' option to set 'C:/my_app' as initial
    directory. But I want my initial directory to be also a root directory, so
    the user cannot pick any directory outside 'C:/my_app' folder. I have no
    idea how to do it using standard tkFileDialog.as kdirectory. Is that
    possible?

    Thank you in advance for any hints.

    Best wishes,

    Niki


  • Martin Franklin

    #2
    Re: tkFileDialog.as kdirectory root directory ?

    Ringwraith wrote:[color=blue]
    > Hello!
    >
    > I have the following problem. I use the tkFileDialog.as kdirectory dialog to
    > allow users of my application to pick some subfolder from 'C:/my_app'
    > directory. I use initialdir='C:/my_app' option to set 'C:/my_app' as initial
    > directory. But I want my initial directory to be also a root directory, so
    > the user cannot pick any directory outside 'C:/my_app' folder. I have no
    > idea how to do it using standard tkFileDialog.as kdirectory. Is that
    > possible?
    >
    > Thank you in advance for any hints.
    >
    > Best wishes,
    >
    > Niki
    >
    >[/color]

    Unles there is a speacial windows extra thingy I don't think you could
    stop the user selecting a directory not below C:/my_app however you can
    at least start the directory selector with that as it's initial
    directory like so:


    tkFileDialog.as kdirectory(init ialdir="C:/my_app")


    HTH
    Martin

    Comment

    • Russell E. Owen

      #3
      Re: tkFileDialog.as kdirectory root directory ?

      In article <c206mk$lmi$1@a tlantis.news.tp i.pl>,
      "Ringwraith " <atmo@go2.pl> wrote:
      [color=blue]
      >I have the following problem. I use the tkFileDialog.as kdirectory dialog to
      >allow users of my application to pick some subfolder from 'C:/my_app'
      >directory. I use initialdir='C:/my_app' option to set 'C:/my_app' as initial
      >directory. But I want my initial directory to be also a root directory, so
      >the user cannot pick any directory outside 'C:/my_app' folder. I have no
      >idea how to do it using standard tkFileDialog.as kdirectory. Is that
      >possible?[/color]

      Some possible solutions:
      - Write your own version that does this, e.g. via bindings that detect
      when the user tries to change directory and screens the requested
      change. Unfortunately, from a quick look at tkFileDialog, I did not see
      any easy way to adapt the existing code; unless I missed something you
      may have to pretty much code from scratch.
      - Allow the user to select anything, but then test it and reject it if
      it doesn't meet your requirements. This is trivial to code, but a pain
      for the user.
      - See if you can redesign your code to eliminate the requirement.

      -- Russell

      Comment

      Working...