Seconda part of this tutorial/making of app… see the code here; many things changed.
- you can add text with more ease
- you can increase / decrease fonts while you watch
- can see the number of slide with a bar indicator
- you can use the mouse buttons to move through the slides
import pygame import sys ''' big_screeb_code palette definition the colors used in the game 24.1.2021 ''' text_for_slides = """5CE - Freccia a sinistra e destra per andare indietro/avanti - rotellina del mouse per modificare la grandezza del carattere Cos'è il marketing? Insieme di attività finalizzate a soddisfare i clienti, raggiungendo al contempo gli obiettivi dell'azienda Le imprese orientate alla produzione... Pensano che le imprese acquisteranno i prodotti se venduti ad un prezzo conveniente Domanda > offerta Le imprese orientate alle vendite... Pensano che i clienti vadano persuasi con campagne pubblicitarie. Non hanno interesse a mantenere un rapporto stabile col cliente. Mercati con domanda scarsa Le imprese orientate al mercato... 1. Analizzano il mercato 2. Progettano il prodotto 3. Cercano rapporto di fiducia col cliente Il marketing strategico è orientato - al lungo periodo - al breve periodo Al lungo periodo Le fasi del marketing strategico - Analisi: - interna e del mercato - segmentazione - Scelta: - target - posizionamento - Analisi SWOT: scelta degli obiettivi Quali sono le caratteristiche del servizio? - Intangibilità: immateriali - deperibilità: non immagazzinabili - contestualità: presenza contemporanea del cliente e di chi presta il servizio Chi è il soggetto che svolge il - marketing privato - marketing pubblico - marketing integrato Chi è il soggetto che svolge il - marketing privato: impresa - marketing pubblico: ente pubblico - marketing integrato: pubblico e privato Quale legge ha istituito gli STL (sistemi turistici locali)? L.135 del 2001 Che caratteristiche ha il destination marketing? Analizza le motivazioni dei turisti e le esprienze che vogliono vivere proponendo un territorio in grado di soddisfare queste esigenze. Il destination marketing è un turismo integrato? Sì, prevede interventi di operatori pubblici e privati. Quali sono i settori turistici emergenti? Il turismo sostenibile (rispetto dell'ambiente) --- Il turismo termale --- il turismo esperienziale (ricerca di esperienze ed emozioni, immersione nella cultura locale) --- il turismo delle radici (riscoperta delle proprie origini presso gli italiani residenti all'estero) """ text_for_slides = text_for_slides.split("\n\n") text_for_slides = [str(n) + "\n" + page for n, page in enumerate(text_for_slides)] counter = 0 pygame.init() class Game: def __init__(self, text): self.screen = pygame.display.set_mode((1000,600), pygame.RESIZABLE) self.clock = pygame.time.Clock() self.title_font_size = 64 self.slides_counter = 0 self.font_init(text) self.mainloop() def increase_font(self): self.title_font_size += 1 def mainloop(self): "This runs until you quit or escape" self.game = 1 # bool that if 1 the game goes on while self.game: for event in pygame.event.get(): self.game = self.check_exit(event) # quit or escape self.keypressed(event) # self.update_screen() pygame.display.update() self.clock.tick(60) self.quit() # exit from the game def update_screen(self): self.screen.blit(self.title_surface, (30, 50)) # self.fx_title_grow() def quit(self): "Exit from the game" pygame.quit() sys.exit() def check_exit(self, event): "Check if user presses quit or escape" quit = event.type == pygame.QUIT exit = event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE if quit or exit: self.game = 0 return self.game def go_on(self): if self.slides_counter < len(text_for_slides) - 1: self.slides_counter += 1 def go_back(self): if self.slides_counter > 0: self.slides_counter -= 1 def keypressed(self, event): "Makes the slides go on with right, back with left" if event.type == pygame.KEYDOWN: # RIGHT KEY if event.key == pygame.K_RIGHT: self.go_on() self.screen.fill((0, 0, 0)) # LEFT KEY if event.key == pygame.K_LEFT: self.go_back() self.screen.fill((0, 0, 0)) if event.key == pygame.K_d: self.screen self.screen.fill((0, 0, 0)) self.font_init(text_for_slides[self.slides_counter]) # MOUSE WHEEL ==> INCREASE SIZE OF THE LETTERS / DECREASE if event.type == pygame.MOUSEBUTTONDOWN: # Mose wheel if event.button == 4: self.title_font_size += 6 elif event.button == 5: self.title_font_size -= 6 elif event.button == 3: self.go_on() elif event.button == 1: self.go_back() self.font_init(text_for_slides[self.slides_counter]) def font_init(self, text): "Show text in different rows if there is a #" self.text = text self.title_font = pygame.font.SysFont("Arial", self.title_font_size) self.top_font = pygame.font.SysFont("Arial", 24) self.win_w, self.win_h = pygame.display.get_surface().get_size() self.title_surface = pygame.Surface((self.win_w, self.win_h)) space = 0 text = text.split("\n") num = len(text) num_sld = len(text_for_slides) for m, row in enumerate(text): if m == 0: row = self.top_font.render("_"*(self.slides_counter) + row, 0, (0, 255, 0)) else: row = self.title_font.render(row, 0, (255, 255, 255)) self.title_surface.blit(row, (0, 0 + space)) space += self.title_font_size self.screen.blit(self.title_surface, (0, 0)) def fx_title_grow(self): "FX: the title grows" if self.title_font_size < 100: if self.title_font_size % 3 == 0: self.title_surface = self.title_font.render(self.text, 0, pygame.Color("Coral")) else: self.title_surface = self.title_font.render(self.text, 0, pygame.Color("Black")) self.title_font_size += 5 self.title_font = pygame.font.SysFont("Arial", self.title_font_size) # self.font_init() else: self.title_surface = self.title_font.render(self.text, 0, pygame.Color("White")) Game("""Usa le frecce per scorrere il testo - Freccia a sinistra e destra per andare indietro/avanti - rotellina del mouse per modificare la grandezza del carattere""")
The video of the app v. 1.0
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame