[Tkinter] first app

C

Club-B42

my questions are
1. how to force focus to Entry widget
2. how to link the buttons and launch(servernumber, button) function

see for sources below or in attachment

=========================================================================
la2launcher.py
=========================================================================
# Line Age II Launcher
# futures are
# * select server
# * account registration
# * reset game options


from Tkinter import *
from config import *


def launch(servernumber, button):
"""server number - server number entered, button - string =
['start'|'reg'|'reset']
"""
print servernumber, button


root = Tk()

root.title(msgMainWindowTitle)

l1 = Label(root, text = msgServerNumber).grid(padx = 5, pady = 5, column =
0, row = 0)
e1 = Entry(root, width = 4)
e1.grid(padx = 5, pady = 5, column = 1, row = 0)
e1.insert(END, '1')
dummy1 = Label(root, text = ' ' * 60).grid(padx = 5, pady = 5, column = 2,
row = 0)

m1 = Message(root, text = msgServersList, width = 400).grid(padx = 5, pady
= 5, column = 0, row = 1, columnspan = 3, sticky = W)

b1 = Button(root, text = msgStartButton).grid(padx = 5, pady = 5, column =
0, row = 2)
b2 = Button(root, text = msgRegistrationButton).grid(padx = 5, pady = 5,
column = 1, row = 2)
b3 = Button(root, text = msgResetConfigsButton).grid(padx = 5, pady = 5,
column = 2, row = 2, sticky = E)

root.mainloop()
=========================================================================


=========================================================================
config.py
=========================================================================
# codepage = cp1251
#
#
#


def u(s):
return unicode(s, 'cp1251')


msgMainWindowTitle = u('Line Age II óÔÁÒÔÅÒ - ÷ÙÂÏÒ ÓÅÒ×ÅÒÁ,
ÒÅÇÉÓÔÒÁÃÉÑ É ÎÁÓÔÒÏÊËÉ')
msgServerNumber = u('îÏÍÅÒ ÓÅÒ×ÅÒÁ')
msgStartButton = u(' úÁÐÕÓË ÉÇÒÙ ')
msgRegistrationButton = u(' òÅÇÉÓÔÒÁÃÉÑ ÎÁ ÓÅÒ×ÅÒÅ ')
msgResetConfigsButton = u(' óÂÒÏÓÉÔØ ÎÁÓÔÒÏÊËÉ ÉÇÒÙ ')


msgServersList = u("""îÏÍÅÒÁ ÓÅÒ×ÅÒÏ×:
[1] http://www.enforce.ru/
[2] http://www.melcosoft.ru/

""")
=========================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,037
Latest member
MozzGuardBugs

Latest Threads

Top