Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Plz Help me translate this JFrame to Python

Posted on 2014-01-12
4
Medium Priority
?
489 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
2 Comments
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Starting up a Project
Suggested Courses

876 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