Solved

Plz Help me translate this JFrame to Python

Posted on 2014-01-12
4
441 Views
Last Modified: 2014-01-21
Hi, I Am a Python NEWBIE

Does anyone have time to plz show me what this kind of Java JFrame + capability looks like in Python?

This will all be for intended use in a game. Is PyGame more suited to this? Why or why not?
What can PyGame do in this situation?

Thanks

class gameWindow extends JFrame implements MouseListener, KeyListener {

  public gameWindow(ClientNetworkEngine CNE, int x, int y) {
            localCNE = CNE;
            setSize...
            setTitle("Game Window");
            ExternalGameLoopThread eglt = new ExternalGameLoopThread(this);
            setLocation(x,y);
            setVisible(true);
            addMouseListener(this);
            addKeyListener(this);
            eglt.start();
            
  }
       public mousePressed(MouseEvent m) {
           System.out.println("mouse pressed at : "+m.getX()+" , "+m.getY());
       }
       public  keyPressed(KeyEvent k ) {
           System.out.println("key pressed : "+k.getChar());
       }

}

Open in new window

0
Comment
Question by:beavoid
4 Comments
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39778288
Python is just a language. To do anything like a JFrame (ie. a GUI) you would have to select which framework/toolkit to use with Python to achieve this, as there are a number of them. See here... https://wiki.python.org/moin/GuiProgramming    You'll notice that PyGame is one of them, is that the one that you want to use?
0
 

Author Comment

by:beavoid
ID: 39778398
I think PyGame looks perfect for my needs.
Do you think it will be decent speed / frame-rate for a fully functioning network RTS?
ie a Blizzard quality RTS. Full screen is a big plus. Will graphics at full screen be clunky?

This means I wont have to be mired in Direct X? Which compared to pygame looks tough.

Thanks
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to count occurrences of each item in an array.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now