472,337 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,337 software developers and data experts.

Tkinter- Creating the application call with and without Graphical User Inetrface

440 256MB
Hi,

I would like to call the same aplication executable with and without Graphical User Interface.

Requirement:

With Tkinter User interface,user can give the inputs to run the application ( Interactive).
Instead user will have this inputs in the file and it will be read by the batch utility or exe for the application

For example:

When we run the 'Sample.Exe' at the Python command prompt.It should ask for whether you want to run as Interactive-Yes, Batch (No).

Case-1 :- With User Interface:
------------------------------------------------

If user type 'Yes ',then Grapical User Interface has to display

Case-2 :- Without User Interface:
------------------------------------------------

if the user types 'No' ,then it should ask for the text file to be given as input tp execute the application.

To sumup:

if 'Yes':
# call Graphical User Interface
elif 'No'
# call batch application with < Sample1.in>

Can anybody guide me how to proceed with this options.

Thanks
PSB
May 18 '07 #1
3 2030
bartonc
6,596 Expert 4TB
Here is something that might work for you.
Also included is the tkFileDialog with the native look and feel.
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import Tk, Label
  2. from tkFileDialog import askopenfilename
  3. from SimpleDialog import SimpleDialog
  4.  
  5.  
  6. if __name__ == '__main__':
  7.     root=Tk()
  8.     l = Label(root, text="Starting Application")
  9.     l.pack()
  10.     UIChooser = SimpleDialog(root, "Default is Batch Mode", ["Batch Mode", "Full GUI"],
  11.                              0, 0, "Choose the user interface")
  12.     choice = UIChooser.go()
  13.     if not choice:
  14.         fileName = askopenfilename()
  15.         print fileName
  16.         fileName = fileName or ""
  17.         root.destroy()
  18.     else:
  19.         l.config(text="Running Full GUI")
  20.         root.mainloop()
  21.  
May 19 '07 #2
psbasha
440 256MB
Here is something that might work for you.
Also included is the tkFileDialog with the native look and feel.
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import Tk, Label
  2. from tkFileDialog import askopenfilename
  3. from SimpleDialog import SimpleDialog
  4.  
  5.  
  6. if __name__ == '__main__':
  7.     root=Tk()
  8.     l = Label(root, text="Starting Application")
  9.     l.pack()
  10.     UIChooser = SimpleDialog(root, "Default is Batch Mode", ["Batch Mode", "Full GUI"],
  11.                              0, 0, "Choose the user interface")
  12.     choice = UIChooser.go()
  13.     if not choice:
  14.         fileName = askopenfilename()
  15.         print fileName
  16.         fileName = fileName or ""
  17.         root.destroy()
  18.     else:
  19.         l.config(text="Running Full GUI")
  20.         root.mainloop()
  21.  
Thanks.

But I have to invoke the Batch and Interactive application.Suppose if I am not having the Tkinter installed in my system,then Batch application has to work,if Tkinter is available then I can use either Batch( Without User Interface) or Interactive ( With User Interface)
-PSB
May 19 '07 #3
psbasha
440 256MB
Here is something that might work for you.
Also included is the tkFileDialog with the native look and feel.
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import Tk, Label
  2. from tkFileDialog import askopenfilename
  3. from SimpleDialog import SimpleDialog
  4.  
  5.  
  6. if __name__ == '__main__':
  7.     root=Tk()
  8.     l = Label(root, text="Starting Application")
  9.     l.pack()
  10.     UIChooser = SimpleDialog(root, "Default is Batch Mode", ["Batch Mode", "Full GUI"],
  11.                              0, 0, "Choose the user interface")
  12.     choice = UIChooser.go()
  13.     if not choice:
  14.         fileName = askopenfilename()
  15.         print fileName
  16.         fileName = fileName or ""
  17.         root.destroy()
  18.     else:
  19.         l.config(text="Running Full GUI")
  20.         root.mainloop()
  21.  
Is this piece of code works in UNIX environment?
May 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mark 'Kamikaze' Hughes | last post by:
In the new Python game I'm developing, I need to crop out individual tiles from larger tilesets, and maintain transparency. Unfortunately, I've...
3
by: srijit | last post by:
Hello, Any idea - why the following code crashes on my Win 98 machine with Python 2.3? Everytime I run this code, I have to reboot my machine. I...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I...
7
by: Justin Ezequiel | last post by:
What font is Tkinter using for displaying utf-8 characters? On my Windows XP, most of the characters with names (unicodedata.name) are displayed...
2
by: codecraig | last post by:
Hi, I was reading through the Tkinter tutorial at http://www.pythonware.com/library/tkinter/introduction/index.htm ...and it mentions that by...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you...
7
by: Dick Moores | last post by:
In a couple of places recently I've seen Brent Welch's _Practical Programming in Tcl & Tk_ (<http://tinyurl.com/ynlk8b>) recommended for learning...
44
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I...
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the...
3
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.