Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use wxGraphicsContext.GetTextExtent()? #50

Closed
toshinagata opened this issue Dec 14, 2019 · 2 comments
Closed

How can I use wxGraphicsContext.GetTextExtent()? #50

toshinagata opened this issue Dec 14, 2019 · 2 comments
Assignees

Comments

@toshinagata
Copy link
Contributor

Hi, @pkulchenko, I am trying to use wxGraphicsContext and having a problem. I want to use wxGraphicsContext.GetTextExtent(), but how? The following code does not work.

  frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxSize(800, 600))
  local gc = wx.wxGraphicsContext.Create(frame)
  font = gc:CreateFont(wx.wxFont(10, wx.wxFONTFAMILY_SWISS, wx.wxFONTSTYLE_NORMAL, wx.wxFONTWEIGHT_NORMAL), wx.wxBLACK)
  gc:SetFont(font)
  local tw, th = gc:GetTextExtent("TEXT")  --  This does not work

wxcore_graphics.cpp shows that GetTextExtent() accepts wxDouble arguments, but is there a way to create a wxDouble object and pass it to GetTextExtent()?

@pkulchenko
Copy link
Owner

@toshinagata, should be fixed now.

@toshinagata
Copy link
Contributor Author

@pkulchenko, thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants