Map Program

DeletedUser

Guest
This part contains:

- imports
- variable declaration
- definitions for reading world data and storing these in files in a /DATA subdir of the dir you have stored this python file (you have to make this directory yourself)

Code:
import pygame, sys, time, datetime, os
import urllib.request
from pygame.locals import *
from tkinter import *
from tkinter.colorchooser import askcolor
from time import *
from datetime import datetime

## The following variables are common global variables

global debug; debug = 0
global BLACK; BLACK = (0, 0, 0)
global WHITE; WHITE = (255, 255, 255)
global RED; RED = (255, 0, 0)
global GREEN; GREEN = (0, 255, 0)
global BLUE; BLUE = (0, 0, 255)
global GREY; GREY = (100, 100, 100)
global pics_hor; pics_hor = 1000
global pics_ver; pics_ver = 1000

## The following are the default URLs of the world data

url_players = 'http://en4.grepolis.com/data/players.txt'
url_conquers= 'http://en4.grepolis.com/data/conquers.txt'
url_alliances='http://en4.grepolis.com/data/alliances.txt'
url_towns ='http://en4.grepolis.com/data/towns.txt'

## The following variables are the offsets for towns on each island type

island_1dx = [24,17,10,5,5,7,12,18,25,29,35,42,47,52,57,54,51,45,49,47]
island_1dy = [17,20,24,27,31,36,36,37,42,44,41,41,40,37,33,29,22,24,28,31]
island_7dx = [19,17,16,16,20,24,31,35,45,40,42,45,45,40,40,35,29,24,20,17]
island_7dy = [27,25,21,18,16,18,20,22,23,25,29,32,36,38,43,43,41,43,41,39]

## ----------------------------------------------------------
##
## The following routines read the world data from the internet
## using the URL provided as an argument
## The data is stored in data files in a \DATA subdirectory
## The "r"in the open statement makes the string a raw string
## to avoid problems with the backslask escape chatacter
##
## ----------------------------------------------------------


def read_players(url):
    req = urllib.request.Request(url)
    response = urllib.request.urlopen(req)
    f = open(r'data\players.txt', 'w')
    for line in response:
        player = str(line)
        f.write(player[2:len(player)-3])
        f.write('\n')
    f.close()

def read_conquers(url):
    req = urllib.request.Request(url)
    response = urllib.request.urlopen(req)
    f = open(r'data\conquers.txt', 'w')
    for line in response:
        conquer = str(line)
        f.write(conquer[2:len(conquer)-3])
        f.write('\n')
    f.close()

def read_alliances(url):
    req = urllib.request.Request(url)
    response = urllib.request.urlopen(req)
    f = open(r'data\alliances.txt', 'w')
    for line in response:
        alliance = str(line)
        f.write(alliance[2:len(alliance)-3])
        f.write('\n')
    f.close()

def read_towns(url):
    req = urllib.request.Request(url)
    response = urllib.request.urlopen(req)
    f = open(r'data\towns.txt', 'w')
    for line in response:
        town = str(line)
        f.write(town[2:len(town)-3])
        f.write('\n')
    f.close()

def read_islands(url):
    req = urllib.request.Request(url)
    response = urllib.request.urlopen(req)
    f = open(r'data\islands.txt', 'w')
    for line in response:
        island = str(line)
        f.write(town[2:len(town)-3])
        f.write('\n')
    f.close()


# ---- end of part 1
 
Last edited by a moderator:

DeletedUser

Guest
map program (part 2)

This part contains the data loading routines

Code:
# ---- start of part 2

## ----------------------------------------------------------
##
## The following routines load the world data from the local
## data files in the \data subdirectory
## The data is stored in global variables to use in all routines
## The label statement updates the GUI
## the show_... routines add the data to select lists in the GUI
## The number of data lines loaded is returned
## The Refresh_data routine refreshes the data in the data files
##
## ----------------------------------------------------------

def load_players():
    global player_ID; player_ID = []
    global player_name; player_name = []
    global player_alliance_ID; player_alliance_ID = []
    global player_points; player_points = []
    global player_rank; player_rank = []
    global player_cities; player_cities = []
    f = open (r"data\players.txt", 'r')
    x = 0
    player = f.readline()
    while (len(player) > 0):
        k1 = player.find(',')
        k2 = player.find(',', k1+1)
        k3 = player.find(',', k2+1)
        k4 = player.find(',', k3+1)
        k5 = player.find(',', k4+1)
        player_ID.append(player[0:k1])
        player_name.append(player[k1+1:k2]) 
        player_alliance_ID.append(player[k2+1:k3]) 
        player_points.append(player[k3+1:k4]) 
        player_rank.append(player[k4+1:k5]) 
        player_cities.append(player[k5+1:len(player)-1])
        x+=1
        player = f.readline()
    f.close()
    Label(root, text=str(len(player_ID))+' players').grid(row=0, column=0)
    show_players()
    return x

def show_players():
    listbox_players.delete(0, END)
    s = filter_players.get()
    if (len(s) == 0):
        for item in player_name:
            listbox_players.insert(END, item)
    else:
        for item in player_name:
            if (item.count(s)):
                listbox_players.insert(END, item)

def load_conquers():
    global conquer_town_ID; conquer_town_ID = []
    global conquer_time; conquer_time = []
    global conquer_new_player_ID; conquer_new_player_ID = []
    global conquer_old_player_ID; conquer_old_player_ID = []
    global conquer_new_ally_ID; conquer_new_ally_ID = []
    global conquer_old_ally_ID; conquer_old_ally_ID = []
    global conquer_town_points; conquer_town_points = []
    f = open (r"data\conquers.txt", 'r')
    x = 0
    conquer = f.readline()
    while (len(conquer) > 0):
        k1 = conquer.find(',')
        k2 = conquer.find(',', k1+1)
        k3 = conquer.find(',', k2+1)
        k4 = conquer.find(',', k3+1)
        k5 = conquer.find(',', k4+1)
        k6 = conquer.find(',', k5+1)
        conquer_town_ID.append(conquer[0:k1])
        conquer_time.append(conquer[k1+1:k2]) 
        conquer_new_player_ID.append(conquer[k2+1:k3]) 
        conquer_old_player_ID.append(conquer[k3+1:k4]) 
        conquer_new_ally_ID.append(conquer[k4+1:k5]) 
        conquer_old_ally_ID.append(conquer[k5+1:k6]) 
        conquer_town_points.append(conquer[k6+1:len(conquer)-1])
        x+=1
        conquer = f.readline()
    f.close()
    Label(root, text=str(len(conquer_town_ID))+' conquers').grid(row=2, column=0)
    return x

def load_alliances():
    global alliance_ID; alliance_ID = []
    global alliance_name; alliance_name = []
    global alliance_points; alliance_points = []
    global alliance_rank; alliance_rank = []
    global alliance_cities; alliance_cities = []
    global alliance_members; alliance_members = []
    f = open (r"data\alliances.txt", 'r')
    x = 0
    alliance = f.readline()
    while (len(alliance) > 0):
        k1 = alliance.find(',')
        k2 = alliance.find(',', k1+1)
        k3 = alliance.find(',', k2+1)
        k4 = alliance.find(',', k3+1)
        k5 = alliance.find(',', k4+1)
        alliance_ID.append(alliance[0:k1])
        alliance_name.append(alliance[k1+1:k2]) 
        alliance_points.append(alliance[k2+1:k3]) 
        alliance_cities.append(alliance[k3+1:k4]) 
        alliance_members.append(alliance[k4+1:k5])
        alliance_rank.append(alliance[k5+1:len(alliance)-1]) 
        x+=1
        alliance = f.readline()
    f.close()
    Label(root, text=str(len(alliance_ID))+' allies').grid(row=1, column=0)
    show_alliances()
    return x

def show_alliances():
    listbox_alliances.delete(0, END)
    s = filter_alliances.get()
    if (len(s) == 0):
        for item in alliance_name:
            listbox_alliances.insert(END, item)
    else:
        for item in alliance_name:
            if (item.count(s)):
                listbox_alliances.insert(END, item)

def load_towns():
    global town_ID; town_ID = []
    global town_player; town_player = []
    global town_name; town_name = []
    global town_island_x; town_island_x = []
    global town_island_y; town_island_y = []
    global town_island_number; town_island_number = []
    global town_points; town_points = []
    f = open (r"data\towns.txt", 'r')
    x = 0
    town = f.readline()
    while (len(town) > 0):
        k1 = town.find(',')
        k2 = town.find(',', k1+1)
        k3 = town.find(',', k2+1)
        k4 = town.find(',', k3+1)
        k5 = town.find(',', k4+1)
        k6 = town.find(',', k5+1)
        town_ID.append(town[0:k1])
        town_player.append(town[k1+1:k2])
        town_name.append(town[k2+1:k3]) 
        town_island_x.append(town[k3+1:k4]) 
        town_island_y.append(town[k4+1:k5])
        town_island_number.append(town[k5+1:k6])
        town_points.append(town[k6+1:len(town)-1]) 
        x+=1
        town = f.readline()
    f.close()
    Label(root, text=str(len(town_ID))+' cities').grid(row=0, column=1)
    return x
 
def load_islands():
    global island_ID; island_ID = []
    global island_x; island_x = []
    global island_y; island_y = []
    global island_number; island_number = []
    global island_color; island_color = []
    f = open (r'data\islands.txt', 'r')
    x = 0
    island = f.readline()
    while (len(island) > 0):
        k1 = island.find(',')
        k2 = island.find(',', k1+1)
        k3 = island.find(',', k2+1)
        k4 = island.find(',', k3+1)
        island_ID.append(island[0:k1])
        island_x.append(island[k1+1:k2]) 
        island_y.append(island[k2+1:k3])
        island_number.append(island[k3+1:k4])
        x+=1
        island = f.readline()
    f.close()
    Label(root, text=str(len(island_ID))+' islands').grid(row=1, column=1)
    return x
  
def refresh_data():
    read_conquers(url_conquers)
    read_towns(url_towns)
    read_players(url_players)
    read_alliances(url_alliances)
    x = load_islands(); print (str(x) + 'islands loaded')
    x = load_players(); print (str(x) + 'players loaded')
    x = load_alliances(); print (str(x) + 'alliances loaded')
    x = load_towns(); print (str(x) + 'towns loaded')
    x = load_conquers(); print (str(x) + 'conquers loaded')

# ---- end of part 2
 
Last edited by a moderator:

DeletedUser

Guest
map program (part 3)

This part contains the definitions to generate the maps



Code:
# ---- start of part 3


## ----------------------------------------------------------
##
## The following routines are used for drawing world maps on the WindowSurface
## The "set_at" function sets a (x,y) pixel to a specified color
##
## ----------------------------------------------------------

def show_text(t, x, y, color):            # Writes the text t on the map in (x,y) with color
    basicFont = pygame.font.SysFont('arial', 16)
    text = basicFont.render(t, True, color, BLACK)
    textRect = text.get_rect()
    textRect.top = y
    textRect.left = x
    windowSurface.blit(text, textRect)
    pygame.display.update()

def show_grid():
    for i in range(1,11):
        pygame.draw.line(windowSurface, (125, 125, 125), (100*i, 0), (100*i, 1000), 1)
        pygame.draw.line(windowSurface, (125, 125, 125), (0, 100*i), (1000, 100*i), 1)
        show_text(str((i*10)-10), 100*(i-1)+2, 2, WHITE)
        show_text(str(i-1), 990, 100*(i-1)+2, WHITE)
    pygame.display.update()
                     

def draw_town(x, y, c, size):                   # Plot a big dot representing a town on x,y in color c
    windowSurface.set_at((x, y), c)

    windowSurface.set_at((x+1, y), c)
    windowSurface.set_at((x-1, y), c)
    windowSurface.set_at((x, y+1), c)
    windowSurface.set_at((x, y-1), c)

    if (size == 'big'):
        windowSurface.set_at((x+1, y+1), c)
        windowSurface.set_at((x+1, y-1), c)
        windowSurface.set_at((x-1, y+1), c)
        windowSurface.set_at((x-1, y-1), c)

def draw_cities():                        # Plot all cities from the towns-array in color=white
    for i in range(0, len(town_ID)):
        x = int(town_island_x[i])
        y = int(town_island_y[i])
        draw_town(x, y, GREY, 'small')
    pygame.display.update()

def draw_islands():                       # Plot all islands from the islands-array in choosable color
    color = choose_color()
    for i in range(0, len(island_ID)):
        x = int(island_x[i])
        y = int(island_y[i])
        windowSurface.set_at((x, y), color)
    pygame.display.update()

def draw_player():                        # Plot all cities of the player selected in the player list
    list_item = listbox_players.curselection()[0]
    player_name =  listbox_players.get(list_item)
    player = get_player_ID(player_name)
    color = choose_color()
    for town in range(0, len(town_ID)):
        if (town_player[town] == player):
            x = int(town_island_x[town])
            y = int(town_island_y[town])
            draw_town(x, y, color, 'big')
    pygame.display.update()

def draw_alliance():                      # Plot all cities of all players of an alliance selected in the alliance list
    list_item = listbox_alliances.curselection()[0]
    alliance_name =  listbox_alliances.get(list_item)
    alliance = get_alliance_ID(alliance_name)
    color = choose_color()
    for player in range(0, len(player_ID)):
        if (str(player_alliance_ID[player]) == str(alliance)):
            for town in range(0, len(town_ID)):
                if (town_player[town] == player_ID[player]):
                    x = int(town_island_x[town])
                    y = int(town_island_y[town])
                    draw_town(x, y, color, 'big')
    pygame.display.update()           

def show_conquers():                      # Prepares a map with cities conquered between date_start and date_end
    date_start = datetime(2010, 10, 16)
    date_start = date_start.date()

    date_end = datetime(2010, 10, 26)
    date_end = date_end.date()

    mark = pygame.image.load("mark2.tga").convert_alpha()

    for i in range(0, len(conquer_town_ID)):
        d=datetime.fromtimestamp(float(conquer_time[i]))
        date = d.date()
        if (date > date_start and date < date_end and len(conquer_old_player_ID[i])>1):
            c = conquer_town_ID[i]
            if c in town_ID:
                t = town_ID.index(c)
                x = int(town_island_x[t])
                y = int(town_island_y[t])
                name = town_name[t]
                player = get_player_name(town_player[t])
#                draw_town(x, y, WHITE, 'big')
                windowSurface.blit(mark, (x-5, y-5))
    show_text('Grepolis map world DELTA ('+str(date_start)+') - ('+str(date_end)+')', 20, 30, WHITE)
    show_text('= Cities conquered from active players', 30, 60, WHITE)
    windowSurface.blit(mark, (20-5, 60+5))
    pygame.display.update()

def one_of_top_ten(alliance, count, color):   # plots the cities in color of an alliance and writes a line in color
    for player in range(0, len(player_ID)):
        if (str(player_alliance_ID[player]) == str(alliance)):
            for town in range(0, len(town_ID)):
                if (town_player[town] == player_ID[player]):
                    x = int(town_island_x[town])
                    y = int(town_island_y[town])
                    windowSurface.blit(mark, (x-5, y-5))
    show_text(get_alliance_name(alliance), 10, 700+20*count, color)
    pygame.display.update()
   
## ----------------------------------------------------------
##
## The following routines are used for drawing ocean maps on the WindowSurface
##
## ----------------------------------------------------------


def load_island_images():
    island_1 = pygame.image.load("island_1.tga").convert_alpha()
    island_2 = pygame.image.load("island_2.tga").convert_alpha()
    island_3 = pygame.image.load("island_3.tga").convert_alpha()
    island_4 = pygame.image.load("island_4.tga").convert_alpha()
    island_5 = pygame.image.load("island_5.tga").convert_alpha()
    island_6 = pygame.image.load("island_6.tga").convert_alpha()
    island_7 = pygame.image.load("island_7.tga").convert_alpha()
    island_8 = pygame.image.load("island_8.tga").convert_alpha()
    island_9 = pygame.image.load("island_9.tga").convert_alpha()
    island_10 = pygame.image.load("island_10.tga").convert_alpha()
    mark = pygame.image.load("mark.tga").convert_alpha()

def draw_ocean_islands():
    load_island_images()
    ocean = str(37)
    ox = int(ocean[0:1])*100
    oy = int(ocean[1:2])*100
    print (ocean)
    for i in range(0, len(island_ID)):
        x = int(island_x[i])
        y = int(island_y[i])
        if (x > ox and x < ox + 100):
            if (y > oy and y < oy + 100):
                ID = str(island_number[i])
                if (ID == '1'):
                    print ('plotting island', (x-ox)*10, (y-oy)*10, ID)
                    windowSurface.blit(island_1, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '2'):
                    windowSurface.blit(island_2, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '3'):
                    windowSurface.blit(island_3, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '4'):
                    windowSurface.blit(island_4, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '5'):
                    windowSurface.blit(island_5, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '6'):
                    windowSurface.blit(island_6, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '7'):
                    windowSurface.blit(island_7, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '8'):
                    windowSurface.blit(island_8, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '9'):
                    windowSurface.blit(island_9, ((x-ox)*10-30, (y-oy)*10-30))
                if (ID == '10'):
                    windowSurface.blit(island_10, ((x-ox)*10-30, (y-oy)*10-30))
    pygame.display.update()



def draw_ocean_player():
    ocean = str(37)
    ox = int(ocean[0:1])*100
    oy = int(ocean[1:2])*100
    list_item = listbox_players.curselection()[0]
    player_name =  listbox_players.get(list_item)
    player = get_player_ID(player_name)
    color = choose_color()
    for town in range(0, len(town_ID)):
        if (town_player[town] == player):
            x = int(town_island_x[town])
            y = int(town_island_y[town])
            town_pos = int(town_island_number[town])
            if (x > ox and x < ox + 100):
                if (y > oy and y < oy + 100):
                    print ('city found', x, y, town_pos)
                    found = 0
                    island_type = island_number[island_coords.index(str(x)+','+str(y))]
                    print ('island type = ', island_type)
                    if (int(island_type) == 1):
                        px = (x-ox)*10-30 + island_1dx[town_pos]
                        py = (y-oy)*10-30 + island_1dy[town_pos]
                        draw_town(int(px), int(py), color, 'big')
                    if (int(island_type) == 7):
                        px = (x-ox)*10-30 + island_7dx[town_pos]
                        py = (y-oy)*10-30 + island_7dy[town_pos]
                        draw_town(int(px), int(py), color, 'big')
    pygame.display.update()

def test():
    x=10
##    y=10
##    mark = pygame.image.load("mark.tga").convert_alpha()    
##
##    draw_town(x,y,WHITE, 'big')


# ---- end of part 3
 
Last edited by a moderator:

DeletedUser

Guest
map program (part 4)

This part contains:
- some small definitions
- the user interface
- the main program

Code:
# ---- start of part 4

## ----------------------------------------------------------
##
## The following routines are other small routines
##
## ----------------------------------------------------------

def get_player_ID(player):
    if player in player_name:
        return player_ID[player_name.index(player)]

def get_player_name(player):
    if player in player_ID:
        return player_name[player_ID.index(player)]

def get_alliance_ID(alliance):
    if alliance in alliance_name:
        return alliance_ID[alliance_name.index(alliance)]

def get_alliance_name(alliance):
    if alliance in alliance_ID:
        return alliance_name[alliance_ID.index(alliance)]

def init_map():
    global windowSurface
    os.environ['SDL_VIDEO_WINDOW_POS'] = ('5,20') # this positions the map screen top left.
    windowSurface = pygame.display.set_mode((pics_hor, pics_ver), 0, 32)
    basicfont = pygame.font.SysFont('arial', 16)
    pygame.display.set_caption('Grepolis analyser tool')
    windowSurface.fill(BLACK)
    pygame.display.update()

def save_map():
    filename = filedialog.asksaveasfilename()
    pygame.image.save(windowSurface, filename)

def choose_color():
    (actual_color, hexstr) = askcolor()
    print (actual_color)
    return actual_color

def terminate_program():
    pygame.quit()
    quit()

def draw_alliance_top_ten():
#    draw_cities()
    ally_color=[(255, 0, 0),
                (0, 128, 255),
                (255, 255, 15),
                (255, 0, 255),
                (0, 0, 160),
                (0, 255, 64),
                (0, 125, 0),
                (128, 0, 128),
                (128, 64, 0),
                (255, 128, 0),
                (234, 100, 62),
                (7, 213, 234)]

    xystring = []
    points = []
    colorcode = []


    show_text('Top 12 alliances:', 10, 680, WHITE)    
    for ally in range(1,13):                                           # loop through top twelve alliances
        alliance = alliance_ID[alliance_rank.index(str(ally))]
        print (get_alliance_name(alliance), ' on position ', ally+1, 'as <' + alliance +'>')
        show_text(str(ally) + '-' + get_alliance_name(alliance), 10, 700+20*ally-1, ally_color[ally-1])
        for p in range(0, len(player_ID)):
            if (player_alliance_ID[p] == alliance):
                player = player_ID[p]
#                print (get_player_name(player))
                for t in range(0, len(town_ID)):
                    if (town_player[t] == player):
                        xy_pos = str(town_island_x[t]) + ',' + str(town_island_y[t])
                        if xy_pos in xystring:
                            x = xystring.index(xy_pos)
                            if (int(points[x]) < int(town_points[t])):
#                                print ('replacing ' + points[x] + ' with ' + town_points[t])
                                points[x] = town_points[t]
                                colorcode[x] = ally_color[ally-1]
#                           else:
#                                print ('skipping ' + town_points[t] + ' for ' + points[x])
                        else:
                            xystring.append(xy_pos)
                            points.append(town_points[t])
                            colorcode.append(ally_color[ally-1])


    for i in range(0, len(xystring)):
        xy_pos = xystring[i]
        k = xy_pos.find(',')
        x = int(xy_pos[0:k])
        y = int(xy_pos[k+1:len(xy_pos)])
        draw_town(x, y, colorcode[i], 'big')

    pygame.display.update()
                      



# ------------------- start of main program



pygame.init()   # initialise the pygame engine
root = Tk()     # initialise the graphics user interface

root.title('Grepolis mapping tool')  # text in the title bar
root.geometry('280x600-0-0')     # size and position of the window in screen pixels ( shift 5 pixels to the left and 5 down)

# -------- create text labels

Label(root, text='players').grid(row=0, column=0)           # will be replaced with the number of players after loading
Label(root, text='allies').grid(row=1, column=0)            # will be replaced with the number of allies after loading
Label(root, text='conquers').grid(row=2, column=0)           # will be replaced with the number of conquers after loading
Label(root, text='cities').grid(row=0, column=1)            # will be replaced with the number of cities after loading
Label(root, text='islands').grid(row=1, column=1)           # will be replaced with the number of islands after loading


# -------- create buttons

button = Button(root, text="refresh data", width = 22, command=refresh_data).grid(row=3, column = 0)
button = Button(root, text="draw grid", width = 22, command=show_grid).grid(row=4, column = 0)
button = Button(root, text="draw islands", width = 22, command=draw_islands).grid(row=5, column = 0)
button = Button(root, text="draw cities", width = 22, command=draw_cities).grid(row=6, column = 0)
button = Button(root, text="test button 1", width = 22, command=test).grid(row=7, column = 0)
button = Button(root, text="test button 2", width = 22, command=test).grid(row=8, column = 0)

button = Button(root, text="reset map", width = 22, command=init_map).grid(row=3, column = 1)
button = Button(root, text="ally top 10", width = 22, command=draw_alliance_top_ten).grid(row=4, column = 1)
button = Button(root, text="conquer map", width = 22, command=show_conquers).grid(row=5, column = 1)
button = Button(root, text="save map", width = 22, command=save_map).grid(row=6, column = 1)
button = Button(root, text="quit program", width = 22, command=terminate_program).grid(row=7, column = 1)
button = Button(root, text="test button 3", width = 22, command=test).grid(row=8, column = 1)

button = Button(root, text="filter players", width = 22, command=show_players).grid(row=10, column = 0)
button = Button(root, text="filter alliances", width = 22, command=show_alliances).grid(row=10, column = 1)

button = Button(root, text="draw player", width = 22, command=draw_player).grid(row=12, column = 0)
button = Button(root, text="draw alliance", width = 22, command=draw_alliance).grid(row=12, column = 1)

# -------- create data entry fields

filter_players = Entry(root, width = 22)
filter_players.grid(row=9, column=0)

filter_alliances = Entry(root, width = 22)
filter_alliances.grid(row=9, column=1)

# -------- create select lists

frame = Frame(root)
frame.grid_rowconfigure(0, weight=1)
frame.grid_columnconfigure(0, weight=1)
yscrollbar = Scrollbar(frame)
yscrollbar.grid(row=0, column=1, sticky=N+S)
listbox_players = Listbox(frame, yscrollcommand=yscrollbar.set, height=20)
listbox_players.grid(row=0, column=0, sticky=N+S+E+W)
yscrollbar.config(command=listbox_players.yview)
frame.grid(row=11, column = 0)

frame = Frame(root)
frame.grid_rowconfigure(0, weight=1)
frame.grid_columnconfigure(0, weight=1)
yscrollbar = Scrollbar(frame)
yscrollbar.grid(row=0, column=1, sticky=N+S)
listbox_alliances = Listbox(frame, yscrollcommand=yscrollbar.set, height=20)
listbox_alliances.grid(row=0, column=0, sticky=N+S+E+W)
yscrollbar.config(command=listbox_alliances.yview)
frame.grid(row=11, column = 1)

init_map()   # open the map window

load_islands()
load_players()
load_alliances()
load_towns()
load_conquers()

root.mainloop()  # wait for commands

# end of part 4


Graphics files islands
mark2.tga
complete program
 
Last edited by a moderator:

DeletedUser

Guest
Nice stuff ;) Python I take it?

Now my curious bit. Can you use PHP on the forum to link to somewhere else where the maps are automatically updated to create auto update maps?
 

DeletedUser

Guest
Is it possible to get the mark2.tga that you use in your current version of the maps? Also which directory do we put that into?
 

DeletedUser

Guest
yes I realised that tonight that I also should give you the graphics files. I will up them as well.

Added to part four.
 
Last edited by a moderator:

DeletedUser5

Guest
Nice stuff ;) Python I take it?

Now my curious bit. Can you use PHP on the forum to link to somewhere else where the maps are automatically updated to create auto update maps?

I don't know what's possible with python, but it is perfectly possible to make these into auto updating maps.
 
Top