Python Forum
problem with python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with python
#11
I got this--> https://c.radikal.ru/c07/2104/6b/62735b90ce13.png
Reply
#12
Looks like you have misunderstood this.
Python3 comes already installed in Mint 20.1 so no need to install python.

Was it telling you you needed to do
pip install Tkinter
Quote:
#--------------
#Imports
#--------------
from Tkinter import *
#--------------
# Main Window
#--------------
mainWindow = Tk()
mainWindowTitle = Label(mainWindow, text="Our New GUI")
mainWindowTitle.pack()
mainWindow.mainloop()
Tkinter is the name for python 2.x and you didn't have it installed originally.
For python3 it is called tkinter.
You need to install Python3-tk using the software manager.
Then maybe if you just edit your code so it says
from tkinter import *
instead it won't complain anymore.
Also if you are running it from the command line and your program is called first.py
you do it this way from the directory the file is in:
python3 ./first.py
There are some small syntax differences between python 2.x and python 3.x and I don't think python 2.x is being developed any more. It would be best to just write code in the 3.x version of python.
raarkil likes this post
Reply
#13
I got this then ->>> file:///home/nikita/Pictures/Screenshot%20from%202021-04-28%2019-49-22.png
Reply
#14
sorry i got my mistake
but what i can do with that? --->>> https://b.radikal.ru/b32/2104/77/92ba2f345c1e.png
Reply
#15
I can't read your screenshot result.
I gather you ran pip3 but can't read the output.
The easy way is to start a terminal, run the command, highlight all the text you want to copy ( hold down left mouse button and select all you want). That copies it. Switch back here ( alt/tab switches between apps ) and start a reply. Then click the scroll wheel (or left and right button together if using a laptop) and that pastes it.
Sorry just saw your second screenshot and that doesn't make any sense to me. It's also almost unreadable. Why did you post it?
Please just do what we ask you. Doing other things may just make things worse.
Reply
#16
python3 ./window.py

this is working for me thanks
but here is another question, can you tell why codium is telling that this code contains errors if via terminal I just ran it?
from tkinter import *

mainWindow = Tk()
mainWindowTitle = Label(mainWindow, text="Our New GUI")
mainWindowTitle.pack()
mainWindow.mainloop()
Reply
#17
I had never heard of codium. Have you used it on Windows?
Maybe it is intended for python 2.x so perhaps that's why it's complaining.
If you haven't used it before and as you are new to python Thonny is probably better. The one in the software manager is an older one so for support for Python3 go to the thonny website Python IDE for beginners
or just run from a terminal
bash <(wget -O - https://thonny.org/installer-for-linux)
to install it.
I just installed Thonny, copied your code into and ran it without any errors being raised.
Reply
#18
very good program I see, can i set it in GUI interface once I installed to run it quickly?
Reply
#19
It has a GUI interface. Once installed go to
the menu/programming/Thonny.
Once it's running you will see it's icon in the panel at the bottom of the screen. Right click on the icon and select 'Pin to panel' and from then on it will stay there after you close it. You can then click once on it to start it up.
raarkil likes this post
Reply
#20
(Apr-28-2021, 09:31 PM)Barrowman Wrote: It has a GUI interface. Once installed go to
the menu/programming/Thonny.
Once it's running you will see it's icon in the panel at the bottom of the screen. Right click on the icon and select 'Pin to panel' and from then on it will stay there after you close it. You can then click once on it to start it up.

many thanks!
Reply


Forum Jump:

User Panel Messages

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