In the machining sketch, can I control the position of the display window?

I hope this is the correct site for this question, sorry if not.

In the machining sketch, can I control the start position of the display window? The function size()

that should be called first allows you to specify only the width and height.

This happened as a likely problem. Now I'm starting to use the G4P (GUI for Processing) library, where the position GWindow()

has position parameters, but they don't seem to refer to the main display window but to the entire monitor screen, and I want additional windows to appear in the main window. This is especially important when I want to transfer the use of a program from my desktop (1280 x 1024 pixels monitor) to my laptop (1280 x 800 pixels).

+3


source to share


2 answers


Assuming you are talking about Java mode, then you have access to a variable called frame.

However, the frame variable doesn't seem to be available until the setup () function finishes, so after that you need to access it. This works for me:



boolean frameMoved = false;

void setup() {
  size(500, 500);
}

void draw() {

  if(!frameMoved){
    frame.setLocation(100, 100);
    frameMoved = true;
  }

  background(0);
}

      

There might be a smarter way to do this, but it works for me.

+6


source


I had a negative function with a frame.setLocation solution in Processing 3.5.1 after using surface.setsize to determine the size of a thumbnail from a variable. The code below works without the need for a boolean burner expression.



void setup() {
  int myVariableW=600;
  surface.setSize(myVariableW,400);
}

void draw() {
  background(0);
  if(1==frameCount) surface.setLocation(150,100);
  ellipse(300,300,200,100);
}

      

0


source







All Articles