cantera/interfaces/python/MixMaster/utilities.py
Ray Speth 6cb4bd93ce Cleaned up whitespace in all Python files using reindent.py
4 spaces per indentation level, no tabs, no trailing whitespace,
and a single newline at end of each file.
2012-02-27 18:13:05 +00:00

39 lines
941 B
Python

import string
import os, sys
import types, traceback
try:
from Tkinter import Tk
import tkMessageBox
_hasTk = 1
except:
_hasTk = 0
def write_CSV(f,x):
"""write list x to file f in comma-separated-value format."""
for e in x:
f.write( `e`+',')
f.write('\n')
def _print_value(name, value, unitstr):
print string.rjust(name, 15)+ \
string.rjust('%10.5e' %value, 15) + ' ' + \
string.ljust(unitstr,5),
def hasTk():
try:
import tkMessageBox
return 1
except:
return 0
def handleError(message = '<error>', window = None,
fatal = 0, warning = 0, options = None):
if warning:
tkMessageBox.showwarning(title = 'Warning', message = message,
parent = window)
else:
m = tkMessageBox.showerror(title = 'Error', message = message,
parent = window)