I have a Pygame programme and I found on internet a website with a live html object, that I whant in my pygame window. I'v tried lot's of moduls, but I have not found what I wanted.
Is it possible to have the entire window/onglet of Firefox or Chrome, or just a (div) html object.
Here is my pygame code :
import pygame
import pyperclip
import autoit
import math
import time
import tkinter as tk
from tkinter import filedialog
import os
import ftplib
from shutil import copyfile
from datetime import datetime
import pytz
from random import seed
from random import randint
import time
file1 = open('nvpn.txt', 'r')
Lines = file1.readlines()
# Start pygame
pygame.init()
clock = pygame.time.Clock()
# set the pygame window name
pygame.display.set_caption('Agents of shield')
# define the RGB value for white,
# green, blue colour .
white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
class CustText:
def __init__(self,content, fontSize, color1, color2, posX, posY):
self.text = pygame.font.Font('freesansbold.ttf', fontSize).render(content, True, color1, color2)
x = self.text.get_rect()[0]/2
y = self.text.get_rect()[1]/2
self.textRect = (int(x) + posX, int(y) + posY)
def main():
loop = True
fenetre = pygame.display.set_mode((640, 480))
# Desclarations
a1 = Lines[randint(0, 2)]
Text2 = CustText(a1, 18, (0, 0, 0), (255, 255, 255), 10, 100)
print(a1)
while loop:
fenetre.fill(white)
a = datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M:%S")
heures = a[0] + a[1]
minutes = a[3] + a[4]
seconde = a[6] + a[7]
difSec = 60 - int(seconde)
difMin = 59 - int(minutes)
if datetime.now().day == 26:
difHeures = 43 - int(heures)
else:
difHeures = 43 - int(heures)
a2 = str(difHeures) + "H " + str(difMin) + "M " + str(difSec) + "S "
timeInEast2 = a2
timeInEast = str(a)
Text1 = CustText(timeInEast, 30, (0, 0, 0), (255, 255, 255), 10, 10)
Text3 = CustText(timeInEast2, 30, (0, 0, 0), (255, 255, 255), 10, 50)
fenetre.blit(Text1.text, Text1.textRect)
fenetre.blit(Text2.text, Text2.textRect)
fenetre.blit(Text3.text, Text3.textRect)
# Si quitter alors quitter
for event in pygame.event.get():
if event.type == pygame.QUIT:
while True:
quit()
if pygame.mouse.get_pressed()[2]:
pyperclip.copy(a1.split(":")[0])
if pygame.mouse.get_pressed()[0]:
pyperclip.copy(a1.split(":")[1])
# Actualisation de l'affichage
pygame.display.flip()
clock.tick(30)
if __name__ == '__main__':
main()