0

i'm creating a desktop application that make use of Python as the backend application. In a simple scenario i would like to display random numbers continuously (For e.g. in console window)

import random
from time import sleep

while True:
   print "Random number: " + str(random.randint(1, 10))
   sleep(0.5)

I came upon this article https://www.fyears.org/2017/02/electron-as-gui-of-python-apps-updated.html which make use of the input to calculate the numbers dynamically.

May i ask how do i implement the script above without using any button? I'm stuck with what to put in the renderer.js to render the above logic.

  • I think using two languages for such simple purpose is an overkill. You can check [this](https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range) to generate random numbers in javascript. Still, if you want to have two applications you need to pass the numbers to electron app, which can be done through simple REST interface – devilpreet Jul 18 '17 at 06:13
  • Is there a way to achieve the same effect in HTML?? A new line will be appended when there is a new random number generated – user3749395 Jul 18 '17 at 06:22

0 Answers0