Re: [Tutor] Witch gui to choose for this script?

2006-10-27 Thread Luke Paireepinart
rolando wrote:
 Well, I don't know if I can ask this question here, but never mind 
 that :)

 It´s like this, I created this python script that translates human 
 language to Al-bhed language (it's a language from the game Final 
 Fantasy 10, it's basicly a change in the letters for example A becomes 
 W or B become H).

 Since I like the script, and it's my first program, I am now trying 
 to create a GUI for it.

 So what do you recommend?

I don't think something like this lends itself to a particular GUI set,
so the question I have to ask you is:
Do you feel lucky?

Just kidding.
It's really up to you on this one.
TKInter would probably be easier to learn, since it's your first program.
You could go the route of a GUI builder such as Boa Constructor, but I'd 
recommend that you learn
how to use a GUI toolkit before you use a builder, so that you know 
exactly what the builder is automating for you.

However, are you sure you want to jump into a GUI right now?
If you're just going for a simple two-textbox, one button, 'type here, 
hit the button, and the translated text appears in the other box'
type thing, and not something fancy, I guess it's about as simple of an 
introduction to a GUI toolkit as you can get, aside from a
label that says Hello, World or other such thing.
Just remember that it's important that you have a firm understanding of 
python's built-ins, and I guess Python in general,
before you start trying to use a big external package like a GUI 
toolkit, and a little up-front time learning the basics will help you a 
great deal in the long run.

 I'm going to attach the script, just in case you want to see it.
Good job on attaching the script!
I did want to see it.
I can't read the comments, though, but I think I got what it was doing.

Good luck in whatever you choose to do.
-Luke
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Witch gui to choose for this script?

2006-10-27 Thread rolando
If you're just going for a simple two-textbox, one button, 'type here, 
hit the button, and the translated text appears in the other box' 


Yeah, its something like that :D

Nothing to much fancy, it just that it can get kind of boring always 
going to the linux console to run the script.


I'm going to try the Boa Contructor.


I'm going to attach the script, just in case you want to see it.
Good job on attaching the script!
I did want to see it.
I can't read the comments, though, but I think I got what it was doing.


Yeah, I kind of forgot to translate the comments.

Now I have attached the script with the translated comments.

Also any comments about the program are welcome.





Luke Paireepinart escreveu:

rolando wrote:
Well, I don't know if I can ask this question here, but never mind 
that :)


It´s like this, I created this python script that translates human 
language to Al-bhed language (it's a language from the game Final 
Fantasy 10, it's basicly a change in the letters for example A 
becomes W or B become H).


Since I like the script, and it's my first program, I am now trying 
to create a GUI for it.


So what do you recommend?


I don't think something like this lends itself to a particular GUI set,
so the question I have to ask you is:
Do you feel lucky?

Just kidding.
It's really up to you on this one.
TKInter would probably be easier to learn, since it's your first program.
You could go the route of a GUI builder such as Boa Constructor, but 
I'd recommend that you learn
how to use a GUI toolkit before you use a builder, so that you know 
exactly what the builder is automating for you.


However, are you sure you want to jump into a GUI right now?
If you're just going for a simple two-textbox, one button, 'type here, 
hit the button, and the translated text appears in the other box'
type thing, and not something fancy, I guess it's about as simple of 
an introduction to a GUI toolkit as you can get, aside from a

label that says Hello, World or other such thing.
Just remember that it's important that you have a firm understanding 
of python's built-ins, and I guess Python in general,
before you start trying to use a big external package like a GUI 
toolkit, and a little up-front time learning the basics will help you 
a great deal in the long run.


I'm going to attach the script, just in case you want to see it.
Good job on attaching the script!
I did want to see it.
I can't read the comments, though, but I think I got what it was doing.

Good luck in whatever you choose to do.
-Luke




#!/usr/bin/python
#V 0.4
import string

contador = s # Creates a counter that checks if it should run the script or not

while contador.lower() == s or contador.lower() == sim: # While the counter is a lower s or sim (that's yes in portuguese) the program doesn't quit

	print Escolhe a lingua que queres traduzir. [p]ortugues ou [a]l-bhed

	lingua = raw_input() # Chosse the language to translate
	
	if lingua.isspace() == True: # If lingua is only white space

		print Tens de escrever alguma coisa ok?

	if lingua == : # If lingua is empty
		
		print Tens de escrever alguma coisa ok?

	if lingua.lower() == a or lingua.lower() == al-bhed:
		lista = string.maketrans('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'epstiwknuvgclrybxhmdofzqajEPSTIWKNUVGCLRYBXHMDOFZQAJ') # Creates the list of letter, and the way they are going to be changed

		print Escreve a palavra que queres traduzir.

		palavra = raw_input() # Ask for a word

		print  + palavra.translate(lista) +  # Print the translated words

	if lingua.lower() == p or lingua.lower() == portugues:
		lista = string.maketrans('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ypltavkrezgmshubxncdijfqowYPLTAVkREZGMSHUBXNCDIJFQOW') # Creates the list of letter, and the way they are going to be changed

		print Escreve a palavra que queres traduzir.

		palavra = raw_input() # Ask for a word

		print  + palavra.translate(lista) +  # Print the translated words
	

	print Ainda tens mais alguma coisa para traduzir? [S/N]
	
	contador = raw_input() # Possibility of changing the counter in the begging of the script

if contador.lower() == n or contador.lower() == nao: # If counter equals lower n or nao (that portugues for no) the program quits and prints the lower message
	print Entao adeus.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Witch gui to choose for this script?

2006-10-27 Thread Kent Johnson
rolando wrote:
 Well, I don't know if I can ask this question here, but never mind that :)

Yes, it's fine.
 
 It´s like this, I created this python script that translates human 
 language to Al-bhed language (it's a language from the game Final 
 Fantasy 10, it's basicly a change in the letters for example A becomes W 
 or B become H).
 
 Since I like the script, and it's my first program, I am now trying to 
 create a GUI for it.
 
 So what do you recommend?

I think Tkinter is the easiest to get started with. You might also like 
to try PythonCard which is a wrapper around wxPython that makes it 
easier to use.
 
 I'm going to attach the script, just in case you want to see it.

I have a few comments below.
 
 
 
 
 #!/usr/bin/python
 #V 0.4
 import string
 
 contador = s # Cria um contador que verifica que deve ou nao executar o 
 script
 
 while contador.lower() == s or contador.lower() == sim: # Enquanto o 
 valor for s ou sim o programa nao sai (converte a palavra em minusculas)
 
   print Escolhe a lingua que queres traduzir. [p]ortugues ou [a]l-bhed
 
   lingua = raw_input() # Escolhe a lingua
   
   if lingua.isspace() == True: # Se lingua e constituida por espacos em 
 branco
 
   print Tens de escrever alguma coisa ok?
 
   if lingua == : # Se lingua estiver vazia
   
   print Tens de escrever alguma coisa ok?

These two tests could be combined into
   if not lingua.strip():
 print Tens de escrever alguma coisa ok?

 
   if lingua.lower() == a or lingua.lower() == al-bhed:
   lista = 
 string.maketrans('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 
 'epstiwknuvgclrybxhmdofzqajEPSTIWKNUVGCLRYBXHMDOFZQAJ') # Cria a lista de 
 palavra e de que maneira vao ser trocadas
 
   print Escreve a palavra que queres traduzir.
 
   palavra = raw_input() # Pede por uma palavra
 
   print  + palavra.translate(lista) +  # Imprime as palavras 
 trocadas
 
   if lingua.lower() == p or lingua.lower() == portugues:
   lista = 
 string.maketrans('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 
 'ypltavkrezgmshubxncdijfqowYPLTAVkREZGMSHUBXNCDIJFQOW') # Cria a lista de 
 palavra e de que maneira vao ser trocadas

I would define the two listas outside the loop at the top of the program 
and give them more descriptive names like portugueseToAlBled. I think it 
would make the loop easier to read.

Kent
 
   print Escreve a palavra que queres traduzir.
 
   palavra = raw_input() # Pede por uma palavra
 
   print  + palavra.translate(lista) +  # Imprime as palavras 
 trocadas

You don't need the extra , just print palavra.translate(lista).

Kent
   
 
   print Ainda tens mais alguma coisa para traduzir? [S/N]
   
   contador = raw_input() # Modifica o contador que esta inicio do script
 
 if contador.lower() == n or contador.lower() == nao: # Se contador igual 
 a n ou nao minusculos
   print Entao adeus.
 
 
 
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor