This short Python code gets the local time from the PC as a formatted string using time.strftime('%H:%M:%S'). The time string is displayed in a label using a larger font. A recursive function checks the time five times per second, and updates the time string, if it has changed. Five times per second may sound like overkill, but keeps the display from acting spasmodic.

Member Avatar
Member Avatar
+2 forum 12

Hi, I jus want to ask why is it that the pacman will move but it will get larger when it is painted..also is that the proper way to draw?. here is the code import javax.swing.*; import java.awt.*; public class Mypacman extends JFrame implements Runnable{ int x; public Mypacman(){ setVisible(true); setSize(400,400); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Pacman"); setBackground(Color.black); } public void paint(Graphics g) { g.setColor(Color.RED); g.fillArc(x,100,60,60,30,300); Thread t=new Thread(this); try { t.sleep(100); } catch(Exception e){} t.start(); } public void run(){ if(x<500) { x++; } repaint(); } public static void main(String[]args){ new Mypacman(); } }

Member Avatar
Member Avatar
+0 forum 11

I'm trying to create a code that gives the factorial for a number given. If it is negative, string, or to large of a number an error should return. I figured out how to do the catch for the negative and string, but I'm confused on how to create a catch for a larger number. The teacher gave us this example but it really doesn't help. `long f = 0; f = checked (a * b);` But I don't know which variables or what to do. Any help would be appreciated. using System; public class Factorial { public static void …

Member Avatar
Member Avatar
+0 forum 4

Hello, I would like to display a video file on my website. For example youtube video when someone click the small video icon then a larger video begin to open and showing a video file with a transparent black background. How to do so? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

hi folks. i ve got a lab questions stating: write pseudocode for a program which allows the user to input two numbers (x and Y0 and a code c . if the code has value 1, the program should ouput the larger of X and y and otherwise the smaller. My version of pseudo code is ; step: 1- get the value of A and B 2- get the value of C 3- if (value of code= 1) do compare if x>y print x else print y end. plz correct any errors within this pseudo code.

Member Avatar
Member Avatar
+0 forum 2

The End.