Python Forum
Syntax error for "root = Tk()"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax error for "root = Tk()"
#11
Yeah!!! It runs, after I made some changes to get the GUI window working. I added a few print statements to follow progress. Still fails to connect.

Some of the results:

****
Test button MAC: b'MAC\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

IP is: 192 . 168 . 0 . 168

UDP-IP is: 192.168.0.168

Test button device address: ('192.168.0.168', 50000)

message sent

message sent

message sent

message sent

message sent
*** and then I get the device not found message. Looks like either the socket is not working as expected or the UDP port has changed. I have a query out to a forum for the radio asking what is the default UDP address.

I'm puzzled about the single quotes around the IP address in the "device address". I do not see where they come from or even if they are a problem.

In the mean time, I'd like some input on setting the window, if you are not fed up with me yet. :)

Here is the unaltered code:

# ----------------------------------
#    User Interface
#------------------------------------
def close():
    sock.close()
    root.destroy()
    root.quit()
    
root=Tk()
root.title('Bootloader 2.1')
x = str((root.winfo_screenwidth() - root.winfo_reqwidth()) / 3)
y = str((root.winfo_screenheight() - root.winfo_reqheight()) / 3)
root.geometry('400x300+'+x+'+'+y)
root.maxsize(400, 330)
root.minsize(400, 330)
root.protocol('WM_DELETE_WINDOW', close)
The resulting error:

Error:
Traceback (most recent call last): File "E:\HamStuff\Odyssey\BL2.1\Bootloader2to3Results.pyw", line 24, in <module> root.geometry('400x300+'+x+'+'+y) File "C:\Program Files\Python312\Lib\tkinter\__init__.py", line 2114, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: bad geometry specifier "400x300+573.3333333333334+293.3333333333333"
My guess is that the intent is to place the GUI in a place dependent on the screen size. Also, I suspect the geometry specifier should be an integer, since it is pixels. I modified the code to have fixed values for "x" and "y" or 100 each. That put the GUI in the upper left of the screen.
Reply


Messages In This Thread
Syntax error for "root = Tk()" - by dlwaddel - Jan-25-2024, 02:40 AM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-25-2024, 05:41 AM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-25-2024, 01:25 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-25-2024, 03:43 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-26-2024, 01:07 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-26-2024, 06:10 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-27-2024, 02:06 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-27-2024, 03:51 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-27-2024, 06:42 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-27-2024, 11:37 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-28-2024, 05:39 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-28-2024, 06:07 PM
RE: Syntax error for "root = Tk()" - by menator01 - Jan-28-2024, 06:47 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-28-2024, 07:51 PM
RE: Syntax error for "root = Tk()" - by deanhystad - Jan-28-2024, 11:03 PM
RE: Syntax error for "root = Tk()" - by dlwaddel - Jan-29-2024, 12:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  World Clock syntax error OscarBoots 1 213 May-03-2024, 05:20 AM
Last Post: snippsat
Photo SYNTAX ERROR Yannko 3 447 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 1,733 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Code is returning the incorrect values. syntax error 007sonic 6 1,276 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,373 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 1,327 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 948 Dec-05-2022, 06:38 PM
Last Post: deanhystad
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 1,928 Sep-17-2022, 04:09 AM
Last Post: jttolleson
  Mysql Syntax error in pymysql ilknurg 4 2,414 May-18-2022, 06:50 AM
Last Post: ibreeden
  Solving equation equal to zero: How to resolve the syntax error? alexfrol86 3 2,023 Feb-21-2022, 08:58 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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