WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-30-2011, 10:09 AM
disbeat disbeat is offline
Member
 
Join Date: Oct 2010
Posts: 36
Question FileChooser

Hi,

Is there a built in way to provide a file choosing window or something?

If no, is vizard compatible with libraries like gtk, so I can use its implementation, like in:

http://www.eurion.net/python-snippet...20Chooser.html

Thanks in advance
Reply With Quote
  #2  
Old 03-30-2011, 10:29 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you plan on upgrading to Vizard 4, you can use the vizinput module to display file open/save dialogs:
Code:
import vizinput
filename = vizinput.fileOpen()
filename = vizinput.fileSave()
If you need code that works with Vizard 3, then you can use the win32gui module that comes with Vizard:
Code:
import win32gui
import win32con
import pywintypes

def OpenFileDialog():
	try:
		value = win32gui.GetOpenFileNameW(
				hwndOwner = viz.window.getHandle(),
				InitialDir = '',
				Flags = win32con.OFN_EXPLORER|win32con.OFN_FILEMUSTEXIST|win32con.OFN_NOCHANGEDIR,
				File = '',
				Filter = '' )
	except pywintypes.error:
		return ''
	else:
		return value[0]

def SaveFileDialog():
	try:
		value = win32gui.GetSaveFileNameW(
				hwndOwner = viz.window.getHandle(),
				InitialDir = '',
				Flags = win32con.OFN_EXPLORER|win32con.OFN_NOCHANGEDIR,
				File = '',
				Filter = '' )
	except pywintypes.error:
		return ''
	else:
		return value[0]
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:42 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC