Python Forum
Make a screen appear without using import
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make a screen appear without using import
#1
I am trying to learn python & everytime I see a tutorial they import a library to make a screen appear. in java & javascript I can make the screen appear without using imports. I'm guessing the imports have ways of making the screen appear, so is there a way to make a screen appear that I can set the size without using imports? I'm using python, pycharm.
Reply
#2
by screen do you mean a gui window? javascript you are using your browser as the gui window. Its creating a subwindow within the browser, not on the system. Im not too sure about java because i am not fluent in it enough, but i would assume that they have GUI libraries too.

In python, the gui window is created from scratch. There is a lot of lower level programming to just make bare bones gui window. GUI libraries handle that lower level stuff, and you need to import them to utilize them. This is quite common as programming languages usually do not have a GUI library in their standard library. And if they do there are usually better ones as 3rd party libraries. But even if they were you would have to import or include (whatever) them into your code.

If your on windows, most likely you have installed tkinter along with python. So you have a GUI library already installed and ready to go. You just have to import it. Other GUI libraries would have to be installed.
Recommended Tutorials:
Reply
#3
Well idk exactually what it is called by I typed like size(600,600) in java or createCanvas(600,600) in javascript& a box appears that I make my game in. In java and javascript I don't need to import anything, I guess from reading your post that there is no way I can code without importing something. TY anyways.
Reply
#4
Python starts out as a bare near naked process when it first starts. it has all kinds of cool things it can do. GUI windows are just one of them. so you get to pick what you want to bring in. that's what import is all about.

i very rarely use a window in my programming, so there is no point wasting all that memory by having it there.

the great power of import is that you don't have to use up your memory by having everything there. and Python has more cool stuff than anything else.

there are, i think, about a dozen different graphical systems around that work in different ways. which one does Java have? i think Python has them all available. just pick the one you want to use and import it by its name.

really, import is not hard to do. just find the name for what software you want to add on (your choice) and import it (just one line to do it). some programmers do get crazy and import dozens of things. you can import whatever your computer has on it.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
ty, I just realized the reason I was trying to learn thiscan be done with java. In the long run I needed python to program a robot, but turns out my favorite easy language can do it just fine good bye needing to import something to open a simple window.
Reply
#6
please post here your full code in Java in which to build a GUI window without importing anything.
Recommended Tutorials:
Reply
#7
I don't believe you that it can be done in java without importing anything.

Any sane language is broken into modules, and are imported into local scope. Javascript isn't a sane language, and thus doesn't follow that logic.
Reply
#8
here is the code to make my screen everything is already built into java processing

void setup(){// runs once at start of game
size(300,600); // makes my game window
}

void draw(){// draws every frame
background(0);// colors my background
}


it will make a window any size I want then I can color the background
Reply
#9
(Sep-28-2018, 05:29 PM)metulburr Wrote: please post here your full code in Java in which to build a GUI window without importing anything.
Full code Please.

Where your class ? Where your public static void main(String[] args) ?
Are you using another class to do your main run ? Which would handle your imports.
99 percent of computer problems exists between chair and keyboard.
Reply
#10
(Sep-28-2018, 11:22 PM)ctrembla Wrote: java processing
Bingo. Processing (https://processing.org/) isn't java. It's it's own language, which compiles into java (or something. I'm not sure, the docs are kind of confusing on what it actually does).

Like javascript, processing skips a few steps, because it isn't a general purpose programming language. It exists for no reason other than making graphical things. Python is general purpose, which means you need to do a few extra steps to do particular things. In this case, that means importing a module.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 1 954 Apr-30-2023, 10:11 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020